From 08f5d1dc0898d024fe48f19e21028ec6f2d3d182 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Thu, 9 May 2013 20:08:40 +0000 Subject: [PATCH] Preparatory work for adding a 'Replaces' field to the draft submission tool. - Legacy-Id: 5719 --- ietf/submit/forms.py | 1 + ietf/submit/views.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ietf/submit/forms.py b/ietf/submit/forms.py index f7a0d4309..6c91051c7 100644 --- a/ietf/submit/forms.py +++ b/ietf/submit/forms.py @@ -322,6 +322,7 @@ class AutoPostForm(forms.Form): def __init__(self, *args, **kwargs): self.draft = kwargs.pop('draft', None) self.validation = kwargs.pop('validation', None) + self.replaces = kwargs.pop('replaces', None) super(AutoPostForm, self).__init__(*args, **kwargs) def get_author_buttons(self): diff --git a/ietf/submit/views.py b/ietf/submit/views.py index aaa63c291..a5e0a440d 100644 --- a/ietf/submit/views.py +++ b/ietf/submit/views.py @@ -107,10 +107,14 @@ def draft_status(request, submission_id, submission_hash=None, message=None): message = ('error', 'This submission has been cancelled, modification is no longer possible') status = detail.status allow_edit = None + if detail.group_acronym and detail.revision == '00': + replaces = "Replaces draft" + else: + replaces = None if request.method == 'POST' and allow_edit: if request.POST.get('autopost', False): - auto_post_form = AutoPostForm(draft=detail, validation=validation, data=request.POST) + auto_post_form = AutoPostForm(draft=detail, validation=validation, replaces=replaces, data=request.POST) if auto_post_form.is_valid(): try: preapproval = Preapproval.objects.get(name=detail.filename) @@ -149,7 +153,7 @@ def draft_status(request, submission_id, submission_hash=None, message=None): else: return HttpResponseRedirect(urlreverse(draft_edit, None, kwargs={'submission_id': detail.submission_id })) else: - auto_post_form = AutoPostForm(draft=detail, validation=validation) + auto_post_form = AutoPostForm(draft=detail, validation=validation, replaces=replaces) show_notify_button = False if allow_edit == False or can_cancel == False: