forked from DemocracyClub/WhoCanIVoteFor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurls.py
77 lines (74 loc) · 2.24 KB
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from django.urls import re_path
from elections.views.postcode_view import DummyPostcodeView
from .views import (
PostcodeView,
ElectionsView,
ElectionView,
PostView,
PostcodeiCalView,
RedirectPostView,
PartyListVew,
)
from .helpers import ElectionIDSwitcher
from core.views import TranslatedTemplateView
urlpatterns = [
re_path(r"^$", ElectionsView.as_view(), name="elections_view"),
re_path(
r"^(?P<election_id>[a-z0-9\.\-]+)/post-(?P<post_id>.*)/(?P<ignored_slug>[^/]+)$",
RedirectPostView.as_view(),
name="redirect_post_view",
),
re_path(
r"^(?P<election>[201[05]+)/(?P<ignored_slug>[^/]+)/$",
ElectionView.as_view(),
name="redirect_election_view",
),
re_path(
r"^(?P<election>[a-z\-]+\.[^/]+)/(?P<party_id>(joint-party|party|minor-party|ynmp-party):[0-9\-]+)/$",
PartyListVew.as_view(),
name="party_list_view",
),
#
re_path(
"^(?P<election>[a-z\-]+\.[^/]+)(?:/(?P<ignored_slug>[^/]+))?/$",
ElectionIDSwitcher(election_view=ElectionView, ballot_view=PostView),
name="election_view",
),
re_path(
r"^TE1 1ST/$",
DummyPostcodeView.as_view(postcode="TE1 1ST"),
name="dummy_postcode_view",
),
re_path(
r"^(?P<postcode>[^/]+)/$", PostcodeView.as_view(), name="postcode_view"
),
re_path(
r"^(?P<postcode>[^/]+).ics$",
PostcodeiCalView.as_view(),
name="postcode_ical_view",
),
re_path(
r"^voting_system/fptp/",
TranslatedTemplateView.as_view(
template_name="elections/fptp.html",
extra_context={"voting_system": "First-past-the-post"},
),
name="fptp_voting_system_view",
),
re_path(
r"^voting_system/ams/",
TranslatedTemplateView.as_view(
template_name="elections/ams.html",
extra_context={"voting_sytem": "Additional Member System"},
),
name="ams_voting_system_view",
),
re_path(
r"^voting_system/sv/",
TranslatedTemplateView.as_view(
template_name="elections/sv.html",
extra_context={"voting_sytem": "Supplementary Vote"},
),
name="sv_voting_system_view",
),
]