Commit a9d59b66 authored by Jamesie Pic's avatar Jamesie Pic

Remove pk support in mep url

parent 14648379
...@@ -35,12 +35,6 @@ urlpatterns = [ ...@@ -35,12 +35,6 @@ urlpatterns = [
representative.detail, representative.detail,
name='representative-detail' name='representative-detail'
), ),
# Representative detail by representative pk
url(
r'^(?P<pk>\d+)$',
representative.detail,
name='representative-detail'
),
# List of representatives by group kind and group name or pk # List of representatives by group kind and group name or pk
url( url(
r'^(?P<group_kind>\w+)/(?P<group>.+)$', r'^(?P<group_kind>\w+)/(?P<group>.+)$',
......
...@@ -82,22 +82,14 @@ def index(request, group_kind=None, group=None): ...@@ -82,22 +82,14 @@ def index(request, group_kind=None, group=None):
) )
def detail(request, pk=None, name=None): def detail(request, name=None):
query_set = MemopolRepresentative.objects.select_related(
'country',
'main_mandate'
)
try: try:
query_set = MemopolRepresentative.objects.select_related( representative = query_set.get(slug=name)
'country',
'main_mandate'
)
if pk:
representative = query_set.get(
id=pk
)
elif name:
representative = query_set.get(
slug=name
)
else:
return Http404()
except MemopolRepresentative.DoesNotExist: except MemopolRepresentative.DoesNotExist:
return Http404() return Http404()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment