Fixed errors with the edit state link, the new ability to set an initial state when adding a document, the status date on the edit state form, and brought several tests up to date.
Fixes bug 695, bug 696, bug 697, and bug 698. - Legacy-Id: 3272
This commit is contained in:
parent
47e8f76973
commit
0389ebf3bd
|
@ -258,10 +258,10 @@ class EditInfoTestCase(django.test.TestCase):
|
|||
|
||||
r = self.client.post(url,
|
||||
dict(intended_status=str(draft.intended_status_id),
|
||||
status_date=str(date.today() + timedelta(2)),
|
||||
area_acronym=str(area.area_acronym_id),
|
||||
via_rfc_editor="1",
|
||||
job_owner=job_owner.id,
|
||||
create_in_state=IDState.PUBLICATION_REQUESTED,
|
||||
state_change_notice_to="test@example.com",
|
||||
note="This is a note",
|
||||
telechat_date="",
|
||||
|
@ -441,7 +441,7 @@ class EditPositionTestCase(django.test.TestCase):
|
|||
comments_before = draft.idinternal.comments().count()
|
||||
self.assertTrue(not Position.objects.filter(ballot=draft.idinternal.ballot, ad__login_name="rhousley"))
|
||||
|
||||
r = self.client.post(url, dict(position="discuss"))
|
||||
r = self.client.post(url, dict(position="discuss",discuss_text="A non-empty discuss"))
|
||||
self.assertEquals(r.status_code, 302)
|
||||
|
||||
pos = Position.objects.get(ballot=draft.idinternal.ballot, ad__login_name="rhousley")
|
||||
|
@ -648,14 +648,6 @@ class BallotWriteupsTestCase(django.test.TestCase):
|
|||
self.assertEquals(len(q('textarea[name=approval_text]')), 1)
|
||||
self.assertEquals(len(q('input[type=submit][value*="Save Approval"]')), 1)
|
||||
|
||||
# subject error
|
||||
r = self.client.post(url, dict(
|
||||
last_call_text="Subject: test\r\nhello\r\n\r\n",
|
||||
save_last_call_text="1"))
|
||||
self.assertEquals(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
self.assertTrue(len(q('ul.errorlist')) > 0)
|
||||
|
||||
# save
|
||||
r = self.client.post(url, dict(
|
||||
approval_text="This is a simple test.",
|
||||
|
|
|
@ -84,11 +84,10 @@ def dehtmlify_textarea_text(s):
|
|||
|
||||
class EditInfoForm(forms.Form):
|
||||
intended_status = forms.ModelChoiceField(IDIntendedStatus.objects.all(), empty_label=None, required=True)
|
||||
status_date = forms.DateField(required=False, help_text="Format is YYYY-MM-DD")
|
||||
area_acronym = forms.ModelChoiceField(Area.active_areas(), required=True, empty_label='None Selected')
|
||||
via_rfc_editor = forms.BooleanField(required=False, label="Via IRTF or RFC Editor")
|
||||
job_owner = forms.ModelChoiceField(IESGLogin.objects.filter(user_level__in=(IESGLogin.AD_LEVEL, IESGLogin.INACTIVE_AD_LEVEL)).order_by('user_level', 'last_name'), label="Responsible AD", empty_label=None, required=True)
|
||||
create_in_state = forms.ModelChoiceField(IDState.objects.filter(document_state_id__in=(IDState.PUBLICATION_REQUESTED, IDState.AD_WATCHING)), empty_label=None, required=True)
|
||||
create_in_state = forms.ModelChoiceField(IDState.objects.filter(document_state_id__in=(IDState.PUBLICATION_REQUESTED, IDState.AD_WATCHING)), empty_label=None, required=False)
|
||||
state_change_notice_to = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)
|
||||
note = forms.CharField(widget=forms.Textarea, label="IESG note", required=False)
|
||||
telechat_date = forms.TypedChoiceField(coerce=lambda x: datetime.datetime.strptime(x, '%Y-%m-%d').date(), empty_value=None, required=False)
|
||||
|
@ -136,16 +135,6 @@ class EditInfoForm(forms.Form):
|
|||
# returning item is rendered non-standard
|
||||
self.standard_fields = [x for x in self.visible_fields() if x.name not in ('returning_item',)]
|
||||
|
||||
def clean_status_date(self):
|
||||
d = self.cleaned_data['status_date']
|
||||
if d:
|
||||
if d < date.today():
|
||||
raise forms.ValidationError("Date must not be in the past.")
|
||||
if d >= date.today() + timedelta(days=365 * 2):
|
||||
raise forms.ValidationError("Date must be within two years.")
|
||||
|
||||
return d
|
||||
|
||||
def clean_note(self):
|
||||
# note is stored munged in the database
|
||||
return self.cleaned_data['note'].replace('\n', '<br>').replace('\r', '').replace(' ', ' ')
|
||||
|
@ -209,6 +198,7 @@ def edit_info(request, name):
|
|||
old_ads=False,
|
||||
initial=dict(telechat_date=initial_telechat_date,
|
||||
area_acronym=doc.idinternal.area_acronym_id))
|
||||
|
||||
if form.is_valid():
|
||||
changes = []
|
||||
r = form.cleaned_data
|
||||
|
@ -239,7 +229,6 @@ def edit_info(request, name):
|
|||
setattr(obj, attr, r[attr])
|
||||
|
||||
diff(doc, 'intended_status', "Intended Status")
|
||||
diff(doc.idinternal, 'status_date', "Status Date")
|
||||
if 'area_acronym' in r and r['area_acronym']:
|
||||
diff(doc.idinternal, 'area_acronym', 'Area acronym')
|
||||
diff(doc.idinternal, 'job_owner', 'Responsible AD')
|
||||
|
@ -273,6 +262,7 @@ def edit_info(request, name):
|
|||
doc.idinternal.token_email = doc.idinternal.job_owner.person.email()[1]
|
||||
doc.idinternal.mark_by = login
|
||||
doc.idinternal.event_date = date.today()
|
||||
doc.idinternal.status_date = date.today()
|
||||
|
||||
if changes and not new_document:
|
||||
email_owner(request, doc, orig_job_owner, login, "\n".join(changes))
|
||||
|
@ -284,7 +274,6 @@ def edit_info(request, name):
|
|||
return HttpResponseRedirect(doc.idinternal.get_absolute_url())
|
||||
else:
|
||||
init = dict(intended_status=doc.intended_status_id,
|
||||
status_date=doc.idinternal.status_date,
|
||||
area_acronym=doc.idinternal.area_acronym_id,
|
||||
job_owner=doc.idinternal.job_owner_id,
|
||||
state_change_notice_to=doc.idinternal.state_change_notice_to,
|
||||
|
@ -298,6 +287,8 @@ def edit_info(request, name):
|
|||
if not in_group(request.user, 'Secretariat'):
|
||||
form.standard_fields = [x for x in form.standard_fields if x.name != "via_rfc_editor"]
|
||||
|
||||
if not new_document:
|
||||
form.standard_fields = [x for x in form.standard_fields if x.name != "create_in_state"]
|
||||
|
||||
return render_to_response('idrfc/edit_info.html',
|
||||
dict(doc=doc,
|
||||
|
|
|
@ -91,7 +91,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
|
||||
<tr><td><a href="/idtracker/help/state/">IESG State</>:</td><td>
|
||||
{% if user|in_group:"Area_Director,Secretariat" %}
|
||||
{% if doc.in_ietf_process and user|in_group:"Area_Director,Secretariat" %}
|
||||
<a href="{% url doc_change_state name=doc.draft_name %}"> {{ doc.friendly_state|safe }} </a>
|
||||
{% else %}
|
||||
{{ doc.friendly_state|safe }}
|
||||
|
|
Loading…
Reference in a new issue