urls.py 1.63 KB
Newer Older
Arnaud Fabre's avatar
Arnaud Fabre committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# coding: utf-8
# This file is part of memopol.
#
# memopol is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or any later version.
#
# memopol is distributed in the hope that it will
# be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Affero Public
# License along with django-representatives.
# If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2015 Arnaud Fabre <af@laquadrature.net>
19
from __future__ import absolute_import
Arnaud Fabre's avatar
Arnaud Fabre committed
20

21
from django.conf.urls import url
22

Jamesie Pic's avatar
Jamesie Pic committed
23
from .views import group, representative
24

25 26
urlpatterns = [
    # List of groups by group kind
27
    url(
28 29
        r'^groups/(?P<kind>\w+)?$',
        group.index,
Arnaud Fabre's avatar
Arnaud Fabre committed
30
        name='group-index'
31
    ),
32
    # Representative detail by representative name
33
    url(
34 35
        r'^(?P<name>[-\w]+)$',
        representative.detail,
Arnaud Fabre's avatar
Arnaud Fabre committed
36
        name='representative-detail'
37
    ),
38
    # Representative detail by representative pk
39
    url(
40 41
        r'^(?P<pk>\d+)$',
        representative.detail,
Arnaud Fabre's avatar
Arnaud Fabre committed
42
        name='representative-detail'
43
    ),
44
    # List of representatives by group kind and group name or pk
45
    url(
46 47
        r'^(?P<group_kind>\w+)/(?P<group>.+)$',
        representative.index,
Arnaud Fabre's avatar
Arnaud Fabre committed
48
        name='representative-index'
49
    ),
50
    # List all representatives by default
51
    url(
52 53
        r'',
        representative.index,
Arnaud Fabre's avatar
Arnaud Fabre committed
54
        name='representative-index'
55 56
    ),
]