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
def delrun(request, assignment_id):
assignment = Assignment.objects.get(pk=assignment_id)
if assignment.status == 'sea' or request.user.has_perm("assignment.can_manage_assignment"):
try:
if assignment.status == 'sea' or user.has_perm("assignment.can_manage_assignment"):
assignment.delrun(request.user, blocked=True)
else:
messages.error(request, _('The candidate list is already closed.'))
except Exception, e:
messages.error(request, e)
else:
messages.success(request, _("You have withdrawn your candidature successfully.") )
else:
messages.error(request, _('The candidate list is already closed.'))
return redirect(reverse('assignment_view', args=[assignment_id]))