Skip to content
Extraits de code Groupes Projets
Valider d62ba200 rédigé par Nicolas Joyard's avatar Nicolas Joyard
Parcourir les fichiers

Restore singular-only and add permanent redirect for groups

parent b51f4cf3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -9,6 +9,7 @@ from views.dossier_list import DossierList ...@@ -9,6 +9,7 @@ from views.dossier_list import DossierList
from views.group_list import GroupList from views.group_list import GroupList
from views.representative_detail import RepresentativeDetail from views.representative_detail import RepresentativeDetail
from views.representative_list import RepresentativeList from views.representative_list import RepresentativeList
from views.redirects import RedirectGroupList
import api import api
...@@ -17,43 +18,53 @@ admin.autodiscover() ...@@ -17,43 +18,53 @@ admin.autodiscover()
urlpatterns = [ urlpatterns = [
# Project-specific overrides # Project-specific overrides
url( url(
r'^legislature/representatives?/(?P<group_kind>\w+)/(?P<chamber>.+)/' + r'^legislature/representative/(?P<group_kind>\w+)/(?P<chamber>.+)/' +
r'(?P<group>.+)/$', r'(?P<group>.+)/$',
RepresentativeList.as_view(), RepresentativeList.as_view(),
name='representative-list' name='representative-list'
), ),
url( url(
r'^legislature/representatives?/(?P<group_kind>\w+)/(?P<group>.+)/$', r'^legislature/representative/(?P<group_kind>\w+)/(?P<group>.+)/$',
RepresentativeList.as_view(), RepresentativeList.as_view(),
name='representative-list' name='representative-list'
), ),
url( 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(), RepresentativeDetail.as_view(),
name='representative-detail' name='representative-detail'
), ),
url( url(
r'^legislature/groups?/$', r'^legislature/group/$',
GroupList.as_view(), GroupList.as_view(),
name='group-list' name='group-list'
), ),
url( 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(), GroupList.as_view(),
name='group-list' name='group-list'
), ),
url( url(
r'^legislature/representatives?/$', r'^legislature/groups/(?P<kind>\w+)/$',
RepresentativeList.as_view(), RedirectGroupList.as_view(),
name='representative-list' name='group-list-redirect'
), ),
url( url(
r'^votes/dossiers?/$', r'^votes/dossier/$',
DossierList.as_view(), DossierList.as_view(),
name='dossier-list' name='dossier-list'
), ),
url( url(
r'^votes/dossiers?/(?P<pk>\d+)/$', r'^votes/dossier/(?P<pk>\d+)/$',
DossierDetail.as_view(), DossierDetail.as_view(),
name='dossier-detail' name='dossier-detail'
), ),
......
# coding: utf-8
from django.views.generic.base import RedirectView
class RedirectGroupList(RedirectView):
permanent = True
query_string = True
pattern_name = 'group-list'
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter