Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Political Memory
memopol
Commits
d62ba200
Commit
d62ba200
authored
Jun 08, 2016
by
Nicolas Joyard
Browse files
Restore singular-only and add permanent redirect for groups
parent
b51f4cf3
Changes
2
Hide whitespace changes
Inline
Side-by-side
memopol/urls.py
View file @
d62ba200
...
...
@@ -9,6 +9,7 @@ from views.dossier_list import DossierList
from
views.group_list
import
GroupList
from
views.representative_detail
import
RepresentativeDetail
from
views.representative_list
import
RepresentativeList
from
views.redirects
import
RedirectGroupList
import
api
...
...
@@ -17,43 +18,53 @@ admin.autodiscover()
urlpatterns
=
[
# Project-specific overrides
url
(
r
'^legislature/representative
s?
/(?P<group_kind>\w+)/(?P<chamber>.+)/'
+
r
'^legislature/representative/(?P<group_kind>\w+)/(?P<chamber>.+)/'
+
r
'(?P<group>.+)/$'
,
RepresentativeList
.
as_view
(),
name
=
'representative-list'
),
url
(
r
'^legislature/representative
s?
/(?P<group_kind>\w+)/(?P<group>.+)/$'
,
r
'^legislature/representative/(?P<group_kind>\w+)/(?P<group>.+)/$'
,
RepresentativeList
.
as_view
(),
name
=
'representative-list'
),
url
(
r
'^legislature/representatives?/(?P<slug>[-\w]+)/$'
,
r
'^legislature/representative/$'
,
RepresentativeList
.
as_view
(),
name
=
'representative-list'
),
url
(
r
'^legislature/representative/(?P<slug>[-\w]+)/$'
,
RepresentativeDetail
.
as_view
(),
name
=
'representative-detail'
),
url
(
r
'^legislature/group
s?
/$'
,
r
'^legislature/group/$'
,
GroupList
.
as_view
(),
name
=
'group-list'
),
url
(
r
'^legislature/groups?/(?P<kind>\w+)/$'
,
r
'^legislature/groups/$'
,
RedirectGroupList
.
as_view
(),
name
=
'group-list-redirect'
),
url
(
r
'^legislature/group/(?P<kind>\w+)/$'
,
GroupList
.
as_view
(),
name
=
'group-list'
),
url
(
r
'^legislature/
representatives?
/$'
,
Re
presentative
List
.
as_view
(),
name
=
'
representative-lis
t'
r
'^legislature/
groups/(?P<kind>\w+)
/$'
,
Re
directGroup
List
.
as_view
(),
name
=
'
group-list-redirec
t'
),
url
(
r
'^votes/dossier
s?
/$'
,
r
'^votes/dossier/$'
,
DossierList
.
as_view
(),
name
=
'dossier-list'
),
url
(
r
'^votes/dossier
s?
/(?P<pk>\d+)/$'
,
r
'^votes/dossier/(?P<pk>\d+)/$'
,
DossierDetail
.
as_view
(),
name
=
'dossier-detail'
),
...
...
memopol/views/redirects.py
0 → 100644
View file @
d62ba200
# coding: utf-8
from
django.views.generic.base
import
RedirectView
class
RedirectGroupList
(
RedirectView
):
permanent
=
True
query_string
=
True
pattern_name
=
'group-list'
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment