Fixes for state management by secretariat. Fixes

- Legacy-Id: 3019
This commit is contained in:
Emilio A. Sánchez López 2011-04-04 11:06:21 +00:00
parent c9241edf7b
commit 39c3f6d75f
2 changed files with 9 additions and 2 deletions
ietf/ietfworkflows

View file

@ -39,6 +39,8 @@ def can_edit_state(user, draft):
streamed = get_streamed_draft(draft)
if not streamed or not streamed.stream:
person = get_person_for_user(user)
if not person:
return False
return (is_secretariat(user) or
is_wgchair(person) or
is_wgdelegate(person))

View file

@ -14,6 +14,7 @@ from ietf.ietfworkflows.utils import (get_workflow_for_draft, get_workflow_for_w
update_state, FOLLOWUP_TAG,
get_annotation_tags_for_draft,
update_tags, update_stream)
from ietf.ietfworkflows.accounts import is_secretariat
from ietf.ietfworkflows.streams import (get_stream_from_draft, get_streamed_draft,
get_stream_by_name, set_stream_for_draft)
from ietf.ietfworkflows.constants import CALL_FOR_ADOPTION, IETF_STREAM
@ -55,10 +56,14 @@ class NoWorkflowStateForm(StreamDraftForm):
super(NoWorkflowStateForm, self).__init__(*args, **kwargs)
self.wgs = None
self.onlywg = None
wgs = set(self.person.wgchair_set.all()).union(set(self.person.wgdelegate_set.all()))
if is_secretariat(self.user):
wgs = IETFWG.objects.all()
else:
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()]))
if len(wgs) > 1:
self.wgs = list(wgs)
self.fields['wg'].choices = [(i.group_acronym.pk, i.group_acronym.group_acronym.name) for i in self.wgs]
self.wgs.sort(lambda x,y: cmp(x.group_acronym.acronym, y.group_acronym.acronym))
self.fields['wg'].choices = [(i.pk, '%s - %s' % (i.group_acronym.acronym, i.group_acronym.name)) for i in self.wgs]
else:
self.onlywg = list(wgs)[0].group_acronym