From 41a9bf9953d8f944239118656f190987668c4ea3 Mon Sep 17 00:00:00 2001 From: klmp200 Date: Wed, 7 Jun 2017 18:49:24 +0200 Subject: [PATCH] Elections : Fix tests, cleaned urls and add nice description --- .../templates/election/election_detail.jinja | 1 + election/tests.py | 3 +- election/urls.py | 36 +++++++------------ 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/election/templates/election/election_detail.jinja b/election/templates/election/election_detail.jinja index dd5feff7..78cc5040 100644 --- a/election/templates/election/election_detail.jinja +++ b/election/templates/election/election_detail.jinja @@ -279,6 +279,7 @@ th { {% trans %}Edit{% endtrans %} {% trans %}Delete{% endtrans %} {%- endif -%} +
{{ role.description }} {%- if role.max_choice > 1 and not election.has_voted(user) and election.can_vote(user) %} {% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %} {%- endif %} diff --git a/election/tests.py b/election/tests.py index 91bc350f..61ad1226 100644 --- a/election/tests.py +++ b/election/tests.py @@ -1,10 +1,9 @@ from django.test import TestCase from django.core.urlresolvers import reverse -from django.contrib.auth.models import Group from django.core.management import call_command from django.conf import settings -from core.models import User +from core.models import User, Group from election.models import Election diff --git a/election/urls.py b/election/urls.py index e9c813d7..7c99e8e8 100644 --- a/election/urls.py +++ b/election/urls.py @@ -4,29 +4,17 @@ from election.views import * urlpatterns = [ url(r'^$', ElectionsListView.as_view(), name='list'), - url(r'^archived$', - ElectionListArchivedView.as_view(), name='list_archived'), + url(r'^archived$', ElectionListArchivedView.as_view(), name='list_archived'), url(r'^add$', ElectionCreateView.as_view(), name='create'), - url(r'^(?P[0-9]+)/edit$', - ElectionUpdateView.as_view(), name='update'), - url(r'^(?P[0-9]+)/delete$', - ElectionDeleteView.as_view(), name='delete'), - url(r'^(?P[0-9]+)/list/add$', - ElectionListCreateView.as_view(), name='create_list'), - url(r'^(?P[0-9]+)/role/create$', - RoleCreateView.as_view(), name='create_role'), - url(r'^(?P[0-9]+)/role/edit$', - RoleUpdateView.as_view(), name='update_role'), - url(r'^(?P[0-9]+)/role/delete$', - RoleDeleteView.as_view(), name='delete_role'), - url(r'^(?P[0-9]+)/candidate/add$', - CandidatureCreateView.as_view(), name='candidate'), - url(r'^(?P[0-9]+)/candidate/edit$', - CandidatureUpdateView.as_view(), name='update_candidate'), - url(r'^(?P[0-9]+)/candidate/delete$', - CandidatureDeleteView.as_view(), name='delete_candidate'), - url(r'^(?P[0-9]+)/vote$', - VoteFormView.as_view(), name='vote'), - url(r'^(?P[0-9]+)/detail$', - ElectionDetailView.as_view(), name='detail'), + url(r'^(?P[0-9]+)/edit$', ElectionUpdateView.as_view(), name='update'), + url(r'^(?P[0-9]+)/delete$', ElectionDeleteView.as_view(), name='delete'), + url(r'^(?P[0-9]+)/list/add$', ElectionListCreateView.as_view(), name='create_list'), + url(r'^(?P[0-9]+)/role/create$', RoleCreateView.as_view(), name='create_role'), + url(r'^(?P[0-9]+)/role/edit$', RoleUpdateView.as_view(), name='update_role'), + url(r'^(?P[0-9]+)/role/delete$', RoleDeleteView.as_view(), name='delete_role'), + url(r'^(?P[0-9]+)/candidate/add$', CandidatureCreateView.as_view(), name='candidate'), + url(r'^(?P[0-9]+)/candidate/edit$', CandidatureUpdateView.as_view(), name='update_candidate'), + url(r'^(?P[0-9]+)/candidate/delete$', CandidatureDeleteView.as_view(), name='delete_candidate'), + url(r'^(?P[0-9]+)/vote$', VoteFormView.as_view(), name='vote'), + url(r'^(?P[0-9]+)/detail$', ElectionDetailView.as_view(), name='detail'), ]