Allow chosing the initial state when beginning WG processing of a draft. Fixes bug #1406. Commit ready for merge.
- Legacy-Id: 8608
This commit is contained in:
parent
de94d49665
commit
696e93254a
|
@ -1077,9 +1077,11 @@ class AdoptDraftTests(TestCase):
|
|||
mailbox_before = len(outbox)
|
||||
events_before = draft.docevent_set.count()
|
||||
mars = Group.objects.get(acronym="mars")
|
||||
call_issued = State.objects.get(type='draft-stream-ietf',slug='c-adopt')
|
||||
r = self.client.post(url,
|
||||
dict(comment="some comment",
|
||||
group=mars.pk,
|
||||
newstate=call_issued.pk,
|
||||
weeks="10"))
|
||||
self.assertEqual(r.status_code, 302)
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ def document_main(request, name, rev=None):
|
|||
actions = []
|
||||
|
||||
if can_adopt_draft(request.user, doc):
|
||||
actions.append(("Adopt in Group", urlreverse('doc_adopt_draft', kwargs=dict(name=doc.name))))
|
||||
actions.append(("Manage Document Adoption in Group", urlreverse('doc_adopt_draft', kwargs=dict(name=doc.name))))
|
||||
|
||||
if doc.get_state_slug() == "expired" and not resurrected_by and can_edit:
|
||||
actions.append(("Request Resurrect", urlreverse('doc_request_resurrect', kwargs=dict(name=doc.name))))
|
||||
|
|
|
@ -1209,6 +1209,7 @@ def request_publication(request, name):
|
|||
|
||||
class AdoptDraftForm(forms.Form):
|
||||
group = forms.ModelChoiceField(queryset=Group.objects.filter(type__in=["wg", "rg"], state="active").order_by("-type", "acronym"), required=True, empty_label=None)
|
||||
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")
|
||||
comment = forms.CharField(widget=forms.Textarea, required=False, label="Comment", help_text="Optional comment explaining the reasons for the adoption")
|
||||
weeks = forms.IntegerField(required=False, label="Expected weeks in adoption state")
|
||||
|
||||
|
@ -1218,17 +1219,21 @@ class AdoptDraftForm(forms.Form):
|
|||
super(AdoptDraftForm, self).__init__(*args, **kwargs)
|
||||
|
||||
if has_role(user, "Secretariat"):
|
||||
pass # all groups
|
||||
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'])
|
||||
elif has_role(user, "IRTF Chair"):
|
||||
#The IRTF chair can adopt a draft into any RG
|
||||
group_ids = list(Group.objects.filter(type="rg", state="active").values_list('id', flat=True))
|
||||
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)))
|
||||
self.fields["group"].queryset = self.fields["group"].queryset.filter(id__in=group_ids).distinct()
|
||||
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'])
|
||||
else:
|
||||
self.fields["group"].queryset = self.fields["group"].queryset.filter(role__person__user=user, role__name__in=("chair", "delegate", "secr")).distinct()
|
||||
state_choices = State.objects.filter(type__in=['draft-stream-ietf','draft-stream-irtf'],slug__in=['wg-cand', 'c-adopt', 'adopt-wg', 'info', 'wg-doc'])
|
||||
|
||||
self.fields['group'].choices = [(g.pk, '%s - %s' % (g.acronym, g.name)) for g in self.fields["group"].queryset]
|
||||
|
||||
self.fields['newstate'].choices = [(x.pk,x.name) for x in state_choices]
|
||||
self.fields['newstate'].choices.insert(0,('','--------'))
|
||||
|
||||
@login_required
|
||||
def adopt_draft(request, name):
|
||||
|
@ -1251,10 +1256,10 @@ def adopt_draft(request, name):
|
|||
group = form.cleaned_data["group"]
|
||||
if group.type.slug == "rg":
|
||||
new_stream = StreamName.objects.get(slug="irtf")
|
||||
adopt_state_slug = "active"
|
||||
else:
|
||||
new_stream = StreamName.objects.get(slug="ietf")
|
||||
adopt_state_slug = "c-adopt"
|
||||
|
||||
new_state = form.cleaned_data["newstate"]
|
||||
|
||||
# stream
|
||||
if doc.stream != new_stream:
|
||||
|
@ -1287,7 +1292,6 @@ def adopt_draft(request, name):
|
|||
|
||||
# state
|
||||
prev_state = doc.get_state("draft-stream-%s" % doc.stream_id)
|
||||
new_state = State.objects.get(slug=adopt_state_slug, type="draft-stream-%s" % doc.stream_id, used=True)
|
||||
if new_state != prev_state:
|
||||
doc.set_state(new_state)
|
||||
e = add_state_change_event(doc, by, prev_state, new_state, timestamp=doc.time)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Adopt {{ doc }} in Group{% endblock %}
|
||||
{% block title %}Manage Document Adoption of {{ doc }} in Group{% endblock %}
|
||||
|
||||
{% block morecss %}
|
||||
form.adopt-draft th { width: 8em; }
|
||||
|
@ -11,14 +11,12 @@ p.intro { max-width: 50em; }
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Adopt {{ doc }} in Group</h1>
|
||||
<h1>Manage Document Adoption of {{ doc }} in Group</h1>
|
||||
|
||||
<p class="intro">You can adopt this draft into a group.</p>
|
||||
<p class="intro">You can begin managing the group state of this draft.</p>
|
||||
|
||||
<p class="intro">For a WG, the draft enters the IETF stream and the
|
||||
stream state becomes "Call for Adoption by WG Issued". For an RG, the
|
||||
draft enters the IRTF stream and the stream state becomes "Active RG
|
||||
Document".</p>
|
||||
<p class="intro">For a WG, the draft enters the IETF stream.
|
||||
For an RG, the draft enters the IRTF stream.</p>
|
||||
|
||||
<form class="adopt-draft" action="" method="post">{% csrf_token %}
|
||||
{% for field in form.hidden_fields %}{{ field }}{% endfor %}
|
||||
|
@ -35,7 +33,7 @@ Document".</p>
|
|||
<tr>
|
||||
<td colspan="2" class="actions">
|
||||
<a class="button" href="{{ doc.get_absolute_url }}">Cancel</a>
|
||||
<input class="button" type="submit" value="Adopt Draft"/>
|
||||
<input class="button" type="submit" value="Save"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
Loading…
Reference in a new issue