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
a9d59b66
Commit
a9d59b66
authored
Dec 19, 2015
by
Jamesie Pic
Browse files
Remove pk support in mep url
parent
14648379
Changes
2
Hide whitespace changes
Inline
Side-by-side
legislature/urls.py
View file @
a9d59b66
...
...
@@ -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>.+)$'
,
...
...
legislature/views/representative.py
View file @
a9d59b66
...
...
@@ -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
()
...
...
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