Fixed error message when delrun after the list is closed

This commit is contained in:
Oskar Hahn 2012-09-13 15:07:24 +02:00
parent e64f4f5efc
commit 20ac817d49

View File

@ -187,15 +187,16 @@ def run(request, assignment_id):
@login_required @login_required
def delrun(request, assignment_id): def delrun(request, assignment_id):
assignment = Assignment.objects.get(pk=assignment_id) assignment = Assignment.objects.get(pk=assignment_id)
try: if assignment.status == 'sea' or request.user.has_perm("assignment.can_manage_assignment"):
if assignment.status == 'sea' or user.has_perm("assignment.can_manage_assignment"): try:
assignment.delrun(request.user, blocked=True) assignment.delrun(request.user, blocked=True)
except Exception, e:
messages.error(request, e)
else: else:
messages.error(request, _('The candidate list is already closed.')) messages.success(request, _("You have withdrawn your candidature successfully.") )
except Exception, e:
messages.error(request, e)
else: else:
messages.success(request, _("You have withdrawn your candidature successfully.") ) messages.error(request, _('The candidate list is already closed.'))
return redirect(reverse('assignment_view', args=[assignment_id])) return redirect(reverse('assignment_view', args=[assignment_id]))