def permit_version(request, aversion_id): aversion = AVersion.objects.get(pk=aversion_id) motion = aversion.motion if request.method == 'POST': motion.accept_version(aversion, user=request.user) messages.success(request, _("Version <b>%s</b> accepted.") % (aversion.aid)) else: gen_confirm_form(request, _('Do you really want to authorize version <b>%s</b>?') % aversion.aid, reverse('motion_version_permit', args=[aversion.id])) return redirect(reverse('motion_view', args=[motion.id]))
def reject_version(request, aversion_id): aversion = AVersion.objects.get(pk=aversion_id) motion = aversion.motion if request.method == 'POST': if motion.reject_version(aversion, user=request.user): messages.success(request, _("Version <b>%s</b> rejected.") % (aversion.aid)) else: messages.error(request, _("ERROR by rejecting the version.") ) else: gen_confirm_form(request, _('Do you really want to reject version <b>%s</b>?') % aversion.aid, reverse('motion_version_reject', args=[aversion.id])) return redirect(reverse('motion_view', args=[motion.id]))
message = _( "Candidate <b>%s</b> was withdrawn successfully.") % person else: message = _("<b>%s</b> was unblocked successfully.") % person messages.success(request, message) 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> for the election?" ) % person gen_confirm_form( request, message, reverse('assignment_delother', args=[assignment_id, user_id])) return redirect(reverse('assignment_view', args=[assignment_id])) @permission_required('assignment.can_manage_assignment') def set_active(request, assignment_id): assignment = Assignment.objects.get(pk=assignment_id) assignment.set_active() return redirect(reverse('assignment_view', args=[assignment_id])) @permission_required('assignment.can_manage_assignment') def gen_poll(request, assignment_id): poll = Assignment.objects.get(pk=assignment_id).gen_poll() messages.success(request, _("New ballot was successfully created."))