diff --git a/helios/stats_url_names.py b/helios/stats_url_names.py new file mode 100644 index 0000000000000000000000000000000000000000..2b8ffe2cde27da4c9d8f21341a3c826ee9c4512f --- /dev/null +++ b/helios/stats_url_names.py @@ -0,0 +1,5 @@ +STATS_HOME="stats@home" +STATS_FORCE_QUEUE="stats@force-queue" +STATS_ELECTIONS="stats@elections" +STATS_ELECTIONS_PROBLEMS="stats@elections-problems" +STATS_RECENT_VOTES="stats@recent-votes" diff --git a/helios/stats_urls.py b/helios/stats_urls.py index 9472b7a65ddce87cffa56ce617b49b4037e36af9..ac3b1439f9dae0acd8702b414772c691dbdc2c4f 100644 --- a/helios/stats_urls.py +++ b/helios/stats_urls.py @@ -7,11 +7,12 @@ Ben Adida (ben@adida.net) from django.conf.urls import url from helios.stats_views import (home, force_queue, elections, recent_problem_elections, recent_votes) +import helios.stats_url_names as names urlpatterns = [ - url(r'^$', home), - url(r'^force-queue$', force_queue), - url(r'^elections$', elections), - url(r'^problem-elections$', recent_problem_elections), - url(r'^recent-votes$', recent_votes), + url(r'^$', home, name=names.STATS_HOME), + url(r'^force-queue$', force_queue, name=names.STATS_FORCE_QUEUE), + url(r'^elections$', elections, name=names.STATS_ELECTIONS), + url(r'^problem-elections$', recent_problem_elections, name=names.STATS_ELECTIONS_PROBLEMS), + url(r'^recent-votes$', recent_votes, name=names.STATS_RECENT_VOTES), ] diff --git a/helios/stats_views.py b/helios/stats_views.py index 9c01a7f8d59f8f11e154d74f76c7960c074280f1..5fc07e62a0090b1b1d0fb9c2b05e979b0e548bef 100644 --- a/helios/stats_views.py +++ b/helios/stats_views.py @@ -11,6 +11,7 @@ from django.http import HttpResponseRedirect from helios import tasks from helios.models import CastVote, Election +from helios.stats_url_names import STATS_HOME from helios_auth.security import get_user from security import PermissionDenied from view_utils import render_template @@ -34,7 +35,7 @@ def force_queue(request): for cv in votes_in_queue: tasks.cast_vote_verify_and_store.delay(cv.id) - return HttpResponseRedirect(reverse(home)) + return HttpResponseRedirect(reverse(STATS_HOME)) def elections(request): user = require_admin(request) diff --git a/helios/templates/stats.html b/helios/templates/stats.html index 37468b7150a3e90bf27c1ea7c89028c8a089d231..3f2bffe2b415bf3148bcd716640cbfa7199b9a45 100644 --- a/helios/templates/stats.html +++ b/helios/templates/stats.html @@ -5,11 +5,11 @@ <h1>Admin</h1> <ul> -<li> <a href="{% url "helios.stats_views.elections" %}">elections</a></li> -<li> <a href="{% url "helios.stats_views.recent_votes" %}">recent votes</a></li> -<li> <a href="{% url "helios.stats_views.recent_problem_elections" %}">recent problem elections</a></li> +<li> <a href="{% url "stats@elections" %}">elections</a></li> +<li> <a href="{% url "stats@recent-votes" %}">recent votes</a></li> +<li> <a href="{% url "stats@elections-problems" %}">recent problem elections</a></li> </ul> -<p><b>{{num_votes_in_queue}}</b> votes in queue. {% if num_votes_in_queue %}[<a href="{% url "helios.stats_views.force_queue" %}">force it</a>]{% endif %}</p> +<p><b>{{num_votes_in_queue}}</b> votes in queue. {% if num_votes_in_queue %}[<a href="{% url "stats@force-queue" %}">force it</a>]{% endif %}</p> {% endblock %} diff --git a/helios/templates/stats_elections.html b/helios/templates/stats_elections.html index 7179698334bbaecfc80f458b9b5061d560ddd9ea..215225bc17c28d2ad6c7c1a64eff7cbbe97def5b 100644 --- a/helios/templates/stats_elections.html +++ b/helios/templates/stats_elections.html @@ -5,7 +5,7 @@ <h1>Elections</h1> <p> -<form method="get" action="{% url "helios.stats_views.elections" %}"> +<form method="get" action="{% url "stats@elections" %}"> <b>search</b>: <input type="text" name="q" value="{{q}}"/> <input class="small button" type="submit" value="search" /> <a class="small button" href="?">clear search</a> </form> diff --git a/server_ui/templates/base.html b/server_ui/templates/base.html index ac5f2d13cc11ccd1a60456482fe5199d985e7476..08d769d04a58556afebba04b311df5ba1ec66a49 100644 --- a/server_ui/templates/base.html +++ b/server_ui/templates/base.html @@ -42,7 +42,7 @@ <!-- Right Nav Section --> <ul class="right"> {% if user and user.admin_p %} - <li><a href="{% url "helios.stats_views.home" %}">Admin</a></li> + <li><a href="{% url "stats@home" %}">Admin</a></li> <li class="divider"></li> {% endif %} {% if not settings.MASTER_HELIOS %}