Preparatory work for adding a 'Replaces' field to the draft submission tool.
- Legacy-Id: 5719
This commit is contained in:
parent
c72ab5daa3
commit
08f5d1dc08
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue