fixed message for unblocking users

This commit is contained in:
Oskar Hahn 2012-09-13 21:51:50 +02:00
parent d8136045bb
commit f0f14861e8

View File

@ -193,7 +193,9 @@ def delrun(request, assignment_id):
except Exception, e: except Exception, e:
messages.error(request, e) messages.error(request, e)
else: else:
messages.success(request, _("You have withdrawn your candidature successfully.") ) messages.success(request,
_("You have withdrawn your candidature successfully. "
"You can not be nominated by other participants anymore."))
else: else:
messages.error(request, _('The candidate list is already closed.')) messages.error(request, _('The candidate list is already closed.'))
@ -204,6 +206,7 @@ def delrun(request, assignment_id):
def delother(request, assignment_id, user_id): def delother(request, assignment_id, user_id):
assignment = Assignment.objects.get(pk=assignment_id) assignment = Assignment.objects.get(pk=assignment_id)
person = get_person(user_id) person = get_person(user_id)
is_blocked = assignment.is_blocked(person)
if request.method == 'POST': if request.method == 'POST':
try: try:
@ -211,11 +214,17 @@ def delother(request, assignment_id, user_id):
except Exception, e: except Exception, e:
messages.error(request, e) messages.error(request, e)
else: else:
messages.success(request, _("Candidate <b>%s</b> was withdrawn successfully.") % (person)) if not is_blocked:
message = _("Candidate <b>%s</b> was withdrawn successfully.") % person
else: else:
gen_confirm_form(request, message = _("<b>%s</b> was unblocked successfully.") % person
_("Do you really want to withdraw <b>%s</b> from the election?") \ messages.success(request, message)
% person, reverse('assignment_delother', args=[assignment_id, user_id])) else:
if not is_blocked:
message = _("Do you really want to withdraw <b>%s</b> from the election?") % person
else:
message = _("Do you really want to unblock <b>%s</b> from the election?") % person
gen_confirm_form(request, message, reverse('assignment_delother', args=[assignment_id, user_id]))
return redirect(reverse('assignment_view', args=[assignment_id])) return redirect(reverse('assignment_view', args=[assignment_id]))