Commit 4217b929 authored by Sli's avatar Sli

Avoid moving role order in election by reloading page

parent bc7cfc2d
Pipeline #1427 passed with stage
in 7 minutes and 44 seconds
......@@ -280,7 +280,7 @@ th {
<tbody data-max-choice="{{role.max_choice}}" class="role{{ ' role_error' if role.title in election_form.errors else '' }}{{ ' role__multiple-choices' if role.max_choice > 1 else ''}}">
<tr class="role__title">
<td colspan="{{ election_lists.count() + 1 }}">
<span>{{ role.title }}</span>
<span><b>{{ role.title }}</b></span>
{% if user.can_edit(role) and election.is_vote_editable -%}
<a href="{{url('election:update_role', role_id=role.id)}}">{% trans %}Edit{% endtrans %}</a>
<a href="{{url('election:delete_role', role_id=role.id)}}">{% trans %}Delete{% endtrans %}</a>
......
......@@ -7,6 +7,7 @@ from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.forms import CheckboxSelectMultiple
from django.shortcuts import redirect
from django import forms
from core.views import CanViewMixin, CanEditMixin, CanCreateMixin
......@@ -192,6 +193,7 @@ class ElectionDetailView(CanViewMixin, DetailView):
Role.objects.get(id=role).bottom()
elif action == "top":
Role.objects.get(id=role).top()
return redirect(reverse_lazy('election:detail', kwargs={'election_id': election.id}))
return r
def get_context_data(self, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment