Commit a9d59b66 authored by Jamesie Pic's avatar Jamesie Pic

Remove pk support in mep url

parent 14648379
......@@ -35,12 +35,6 @@ urlpatterns = [
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
url(
r'^(?P<group_kind>\w+)/(?P<group>.+)$',
......
......@@ -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:
query_set = MemopolRepresentative.objects.select_related(
'country',
'main_mandate'
)
if pk:
representative = query_set.get(
id=pk
)
elif name:
representative = query_set.get(
slug=name
)
else:
return Http404()
representative = query_set.get(slug=name)
except MemopolRepresentative.DoesNotExist:
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