@@ -53,32 +53,32 @@ def __unicode__(self):
5353class NoWorkflowStateForm (StreamDraftForm ):
5454 comment = forms .CharField (widget = forms .Textarea , required = False )
5555 weeks = forms .IntegerField (required = False )
56- wg = forms .ChoiceField (required = False )
56+ group = forms .ChoiceField (required = False )
5757
5858 template = 'ietfworkflows/noworkflow_state_form.html'
5959
6060 def __init__ (self , * args , ** kwargs ):
6161 super (NoWorkflowStateForm , self ).__init__ (* args , ** kwargs )
62- self .wgs = None
62+ self .groups = None
6363 if is_secretariat (self .user ):
64- wgs = IETFWG .objects .all ().order_by ('group_acronym__acronym' )
64+ groups = IETFWG .objects .all ().order_by ('group_acronym__acronym' )
6565 else :
6666 if settings .USE_DB_REDESIGN_PROXY_CLASSES :
67- wgs = IETFWG .objects .filter (type = "wg" , state = "active" , role__name__in = ("chair" , "delegate" ), role__person__user = self .user ).order_by ('acronym' ).distinct ()
67+ groups = IETFWG .objects .filter (type__in = [ "wg" , "rg" ], state = "active" , role__name__in = ("chair" , "secr " , "delegate" ), role__person__user = self .user ).order_by ('acronym' ).distinct ()
6868 else :
69- wgs = set ([i .group_acronym for i in self .person .wgchair_set .all ()]).union (set ([i .wg for i in self .person .wgdelegate_set .all ()]))
70- wgs = list (wgs )
71- wgs .sort (lambda x , y : cmp (x .group_acronym .acronym , y .group_acronym .acronym ))
72- self .wgs = wgs
69+ groups = set ([i .group_acronym for i in self .person .wgchair_set .all ()]).union (set ([i .wg for i in self .person .wgdelegate_set .all ()]))
70+ groups = list (groups )
71+ groups .sort (lambda x , y : cmp (x .group_acronym .acronym , y .group_acronym .acronym ))
72+ self .groups = groups
7373 if settings .USE_DB_REDESIGN_PROXY_CLASSES :
74- self .fields ['wg ' ].choices = [(i .pk , '%s - %s' % (i .acronym , i .name )) for i in self .wgs ]
74+ self .fields ['group ' ].choices = [(i .pk , '%s - %s' % (i .acronym , i .name )) for i in self .groups ]
7575 else :
76- self .fields ['wg ' ].choices = [(i .pk , '%s - %s' % (i .group_acronym .acronym , i .group_acronym .name )) for i in self .wgs ]
76+ self .fields ['group ' ].choices = [(i .pk , '%s - %s' % (i .group_acronym .acronym , i .group_acronym .name )) for i in self .groups ]
7777
7878 def save (self ):
7979 comment = self .cleaned_data .get ('comment' ).strip ()
8080 weeks = self .cleaned_data .get ('weeks' )
81- wg = IETFWG .objects .get (pk = self .cleaned_data .get ('wg ' ))
81+ group = IETFWG .objects .get (pk = self .cleaned_data .get ('group ' ))
8282 estimated_date = None
8383 if weeks :
8484 now = datetime .date .today ()
@@ -90,7 +90,10 @@ def save(self):
9090
9191 doc .time = datetime .datetime .now ()
9292
93- new_stream = StreamName .objects .get (slug = "ietf" )
93+ if group .type .slug == "rg" :
94+ new_stream = StreamName .objects .get (slug = "irtf" )
95+ else :
96+ new_stream = StreamName .objects .get (slug = "ietf" )
9497
9598 if doc .stream != new_stream :
9699 e = DocEvent (type = "changed_stream" )
@@ -103,16 +106,16 @@ def save(self):
103106 e .save ()
104107 doc .stream = new_stream
105108
106- if doc .group .pk != wg .pk :
109+ if doc .group .pk != group .pk :
107110 e = DocEvent (type = "changed_group" )
108111 e .time = doc .time
109112 e .by = self .user .get_profile ()
110113 e .doc = doc
111- e .desc = u"Changed group to <b>%s (%s)</b>" % (wg .name , wg .acronym .upper ())
114+ e .desc = u"Changed group to <b>%s (%s)</b>" % (group .name , group .acronym .upper ())
112115 if doc .group .type_id != "individ" :
113116 e .desc += " from %s (%s)" % (doc .group .name , doc .group .acronym )
114117 e .save ()
115- doc .group_id = wg .pk
118+ doc .group_id = group .pk
116119
117120 doc .save ()
118121 self .draft = InternetDraft .objects .get (pk = doc .pk ) # make sure proxy object is updated
@@ -130,7 +133,10 @@ def save(self):
130133
131134 if settings .USE_DB_REDESIGN_PROXY_CLASSES :
132135 from ietf .doc .models import State
133- to_state = State .objects .get (used = True , slug = "c-adopt" , type = "draft-stream-%s" % self .draft .stream_id )
136+ if self .draft .stream_id == "irtf" :
137+ to_state = State .objects .get (used = True , slug = "active" , type = "draft-stream-irtf" )
138+ else :
139+ to_state = State .objects .get (used = True , slug = "c-adopt" , type = "draft-stream-%s" % self .draft .stream_id )
134140 else :
135141 to_state = get_state_by_name (CALL_FOR_ADOPTION )
136142 update_state (self .request , self .draft ,
0 commit comments