|
14 | 14 | update_state, FOLLOWUP_TAG, |
15 | 15 | get_annotation_tags_for_draft, |
16 | 16 | update_tags, update_stream) |
| 17 | +from ietf.ietfworkflows.accounts import is_secretariat |
17 | 18 | from ietf.ietfworkflows.streams import (get_stream_from_draft, get_streamed_draft, |
18 | 19 | get_stream_by_name, set_stream_for_draft) |
19 | 20 | from ietf.ietfworkflows.constants import CALL_FOR_ADOPTION, IETF_STREAM |
@@ -55,10 +56,14 @@ def __init__(self, *args, **kwargs): |
55 | 56 | super(NoWorkflowStateForm, self).__init__(*args, **kwargs) |
56 | 57 | self.wgs = None |
57 | 58 | self.onlywg = None |
58 | | - wgs = set(self.person.wgchair_set.all()).union(set(self.person.wgdelegate_set.all())) |
| 59 | + if is_secretariat(self.user): |
| 60 | + wgs = IETFWG.objects.all() |
| 61 | + else: |
| 62 | + 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()])) |
59 | 63 | if len(wgs) > 1: |
60 | 64 | self.wgs = list(wgs) |
61 | | - self.fields['wg'].choices = [(i.group_acronym.pk, i.group_acronym.group_acronym.name) for i in self.wgs] |
| 65 | + self.wgs.sort(lambda x,y: cmp(x.group_acronym.acronym, y.group_acronym.acronym)) |
| 66 | + self.fields['wg'].choices = [(i.pk, '%s - %s' % (i.group_acronym.acronym, i.group_acronym.name)) for i in self.wgs] |
62 | 67 | else: |
63 | 68 | self.onlywg = list(wgs)[0].group_acronym |
64 | 69 |
|
|
0 commit comments