Skip to content
Snippets Groups Projects
Unverified Commit 1b876a27 authored by Marco Ciotola's avatar Marco Ciotola
Browse files

[DJ1.10] Update stats_urls to have names and be reversed by name

parent 53c42db2
No related branches found
No related tags found
No related merge requests found
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"
......@@ -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),
]
......@@ -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)
......
......@@ -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 %}
......@@ -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>
......
......@@ -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 %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment