Elections : Fix tests, cleaned urls and add nice description

This commit is contained in:
Antoine Bartuccio 2017-06-07 18:49:24 +02:00
parent c4389bb9cd
commit 41a9bf9953
3 changed files with 14 additions and 26 deletions

View File

@ -279,6 +279,7 @@ th {
<a href="{{url('election:update_role', role_id=role.id)}}">{% trans %}Edit{% endtrans %}</a> <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> <a href="{{url('election:delete_role', role_id=role.id)}}">{% trans %}Delete{% endtrans %}</a>
{%- endif -%} {%- endif -%}
<br><span>{{ role.description }}</span>
{%- if role.max_choice > 1 and not election.has_voted(user) and election.can_vote(user) %} {%- if role.max_choice > 1 and not election.has_voted(user) and election.can_vote(user) %}
<strong class="role__multiple-choices-label">{% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %}</strong> <strong class="role__multiple-choices-label">{% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %}</strong>
{%- endif %} {%- endif %}

View File

@ -1,10 +1,9 @@
from django.test import TestCase from django.test import TestCase
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib.auth.models import Group
from django.core.management import call_command from django.core.management import call_command
from django.conf import settings from django.conf import settings
from core.models import User from core.models import User, Group
from election.models import Election from election.models import Election

View File

@ -4,29 +4,17 @@ from election.views import *
urlpatterns = [ urlpatterns = [
url(r'^$', ElectionsListView.as_view(), name='list'), url(r'^$', ElectionsListView.as_view(), name='list'),
url(r'^archived$', url(r'^archived$', ElectionListArchivedView.as_view(), name='list_archived'),
ElectionListArchivedView.as_view(), name='list_archived'),
url(r'^add$', ElectionCreateView.as_view(), name='create'), url(r'^add$', ElectionCreateView.as_view(), name='create'),
url(r'^(?P<election_id>[0-9]+)/edit$', url(r'^(?P<election_id>[0-9]+)/edit$', ElectionUpdateView.as_view(), name='update'),
ElectionUpdateView.as_view(), name='update'), url(r'^(?P<election_id>[0-9]+)/delete$', ElectionDeleteView.as_view(), name='delete'),
url(r'^(?P<election_id>[0-9]+)/delete$', url(r'^(?P<election_id>[0-9]+)/list/add$', ElectionListCreateView.as_view(), name='create_list'),
ElectionDeleteView.as_view(), name='delete'), url(r'^(?P<election_id>[0-9]+)/role/create$', RoleCreateView.as_view(), name='create_role'),
url(r'^(?P<election_id>[0-9]+)/list/add$', url(r'^(?P<role_id>[0-9]+)/role/edit$', RoleUpdateView.as_view(), name='update_role'),
ElectionListCreateView.as_view(), name='create_list'), url(r'^(?P<role_id>[0-9]+)/role/delete$', RoleDeleteView.as_view(), name='delete_role'),
url(r'^(?P<election_id>[0-9]+)/role/create$', url(r'^(?P<election_id>[0-9]+)/candidate/add$', CandidatureCreateView.as_view(), name='candidate'),
RoleCreateView.as_view(), name='create_role'), url(r'^(?P<candidature_id>[0-9]+)/candidate/edit$', CandidatureUpdateView.as_view(), name='update_candidate'),
url(r'^(?P<role_id>[0-9]+)/role/edit$', url(r'^(?P<candidature_id>[0-9]+)/candidate/delete$', CandidatureDeleteView.as_view(), name='delete_candidate'),
RoleUpdateView.as_view(), name='update_role'), url(r'^(?P<election_id>[0-9]+)/vote$', VoteFormView.as_view(), name='vote'),
url(r'^(?P<role_id>[0-9]+)/role/delete$', url(r'^(?P<election_id>[0-9]+)/detail$', ElectionDetailView.as_view(), name='detail'),
RoleDeleteView.as_view(), name='delete_role'),
url(r'^(?P<election_id>[0-9]+)/candidate/add$',
CandidatureCreateView.as_view(), name='candidate'),
url(r'^(?P<candidature_id>[0-9]+)/candidate/edit$',
CandidatureUpdateView.as_view(), name='update_candidate'),
url(r'^(?P<candidature_id>[0-9]+)/candidate/delete$',
CandidatureDeleteView.as_view(), name='delete_candidate'),
url(r'^(?P<election_id>[0-9]+)/vote$',
VoteFormView.as_view(), name='vote'),
url(r'^(?P<election_id>[0-9]+)/detail$',
ElectionDetailView.as_view(), name='detail'),
] ]