Fixed wrong deletion if user clicks "no" in confirm form.
This commit is contained in:
parent
0c5459f96e
commit
82e35bebff
@ -145,6 +145,7 @@ def edit(request, assignment_id=None):
|
||||
def delete(request, assignment_id):
|
||||
assignment = Assignment.objects.get(pk=assignment_id)
|
||||
if request.method == 'POST':
|
||||
if 'submit' in request.POST:
|
||||
assignment.delete()
|
||||
messages.success(request, _('Election <b>%s</b> was successfully deleted.') % assignment)
|
||||
else:
|
||||
@ -204,6 +205,7 @@ def delother(request, assignment_id, user_id):
|
||||
is_blocked = assignment.is_blocked(person)
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'submit' in request.POST:
|
||||
try:
|
||||
assignment.delrun(person, blocked=False)
|
||||
except Exception, e:
|
||||
|
@ -38,8 +38,8 @@ def gen_confirm_form(request, message, url):
|
||||
%s
|
||||
<form action="%s" method="post">
|
||||
<input type="hidden" value="%s" name="csrfmiddlewaretoken">
|
||||
<button type="submit" class="btn btn-mini">%s</button>
|
||||
<button class="btn btn-mini">%s</button>
|
||||
<button type="submit" name="submit" class="btn btn-mini">%s</button>
|
||||
<button name="cancel" class="btn btn-mini">%s</button>
|
||||
</form>
|
||||
"""
|
||||
% (message, url, csrf(request)['csrf_token'], _("Yes"), _("No")))
|
||||
|
Loading…
Reference in New Issue
Block a user