Skip to content

Commit 225c1d9

Browse files
committed
Changed the state choices in the document adoption form to exclude the few that should not be available, rather than explicitly list all others. Makes adding WG/RG states simpler.
- Legacy-Id: 12949
1 parent 1e6f453 commit 225c1d9

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

ietf/doc/views_draft.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ def request_publication(request, name):
12081208

12091209
class AdoptDraftForm(forms.Form):
12101210
group = forms.ModelChoiceField(queryset=Group.objects.filter(type__in=["wg", "rg"], state="active").order_by("-type", "acronym"), required=True, empty_label=None)
1211-
newstate = forms.ModelChoiceField(queryset=State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'],slug__in=['wg-cand', 'c-adopt', 'adopt-wg', 'info', 'wg-doc', 'candidat','active']),required=True,label="State")
1211+
newstate = forms.ModelChoiceField(queryset=State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'], used=True).exclude(slug__in=settings.GROUP_STATES_WITH_EXTRA_PROCESSING), required=True, label="State")
12121212
comment = forms.CharField(widget=forms.Textarea, required=False, label="Comment", help_text="Optional comment explaining the reasons for the adoption.", strip=False)
12131213
weeks = forms.IntegerField(required=False, label="Expected weeks in adoption state")
12141214

@@ -1218,16 +1218,16 @@ def __init__(self, *args, **kwargs):
12181218
super(AdoptDraftForm, self).__init__(*args, **kwargs)
12191219

12201220
if has_role(user, "Secretariat"):
1221-
state_choices = State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'],slug__in=['wg-cand', 'c-adopt', 'adopt-wg', 'info', 'wg-doc', 'candidat','active'])
1221+
state_choices = State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'], used=True).exclude(slug__in=settings.GROUP_STATES_WITH_EXTRA_PROCESSING)
12221222
elif has_role(user, "IRTF Chair"):
12231223
#The IRTF chair can adopt a draft into any RG
12241224
group_ids = list(Group.objects.filter(type="rg", state="active").values_list('id', flat=True))
12251225
group_ids.extend(list(Group.objects.filter(type="wg", state="active", role__person__user=user, role__name__in=("chair", "delegate", "secr")).values_list('id', flat=True)))
12261226
self.fields["group"].queryset = self.fields["group"].queryset.filter(id__in=group_ids).distinct()
1227-
state_choices = State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'],slug__in=['wg-cand', 'c-adopt', 'adopt-wg', 'info', 'wg-doc', 'candidat','active'])
1227+
state_choices = State.objects.filter(type='draft-stream-irtf', used=True).exclude(slug__in=settings.GROUP_STATES_WITH_EXTRA_PROCESSING)
12281228
else:
12291229
self.fields["group"].queryset = self.fields["group"].queryset.filter(role__person__user=user, role__name__in=("chair", "delegate", "secr")).distinct()
1230-
state_choices = State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'],slug__in=['wg-cand', 'c-adopt', 'adopt-wg', 'info', 'wg-doc'])
1230+
state_choices = State.objects.filter(type='draft-stream-ietf', used=True).exclude(slug__in=settings.GROUP_STATES_WITH_EXTRA_PROCESSING)
12311231

12321232
self.fields['group'].choices = [(g.pk, '%s - %s' % (g.acronym, g.name)) for g in self.fields["group"].queryset]
12331233
self.fields['newstate'].choices = [('','-- Pick a state --')]

ietf/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,11 @@ def skip_unreadable_post(record):
515515
# WG Chair configuration
516516
MAX_WG_DELEGATES = 3
517517

518+
# These states aren't available in forms with drop-down choices for new
519+
# document state:
520+
GROUP_STATES_WITH_EXTRA_PROCESSING = ["sub-pub", "rfc-edit", ]
521+
522+
518523
DATE_FORMAT = "Y-m-d"
519524
DATETIME_FORMAT = "Y-m-d H:i T"
520525

0 commit comments

Comments
 (0)