Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
luxcem
memopol
Commits
04b90922
Commit
04b90922
authored
Jan 16, 2017
by
okhin
Browse files
Fixing the non PEP8 compliant lines
parent
2362a475
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/representatives/filters.py
View file @
04b90922
...
...
@@ -16,19 +16,20 @@ class ActiveMandateQueryFilterBackend(BaseFilterBackend):
the parameter used in the query to filter is, by default mandates_active
and it list a list of mandates among which one should be active.
"""
query_param
=
getattr
(
settings
,
'ACTIVE_MANDATES_
QUERY_
PARAM'
,
'active_mandates'
)
query_param
=
getattr
(
settings
,
'ACTIVE_MANDATES_PARAM'
,
'active_mandates'
)
def
filter_queryset
(
self
,
request
,
queryset
,
view
):
qs
=
queryset
if
self
.
query_param
in
request
.
GET
:
if
len
(
request
.
GET
[
self
.
query_param
]):
# We want to check for params in a list of mandates
mandates
=
request
.
GET
[
self
.
query_params
].
split
(
','
)
qs
=
qs
.
filter
(
mandates__in
=
Mandate
.
objects
.
filter
(
Q
(
end_date__gte
=
datetime
.
today
)
|
Q
(
end_date__isnull
=
True
)).
filter
(
Q
(
group__name
=
request
.
GET
[
self
.
query_param
])
|
Q
(
group__abbreviation
=
request
.
GET
[
self
.
query_param
])
)
).
distinct
()
Q
(
end_date__gte
=
datetime
.
today
)
|
Q
(
end_date__isnull
=
True
)).
filter
(
Q
(
group__name__in
=
mandates
)
|
Q
(
group__abbreviation__in
=
mandates
)
)).
distinct
()
return
qs
return
qs
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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