Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
memopol
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
32
Issues
32
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Political Memory
memopol
Commits
22fa8be1
Commit
22fa8be1
authored
Mar 18, 2015
by
luxcem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates search urls
parent
b51b963f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
17 deletions
+20
-17
memopol_representatives/templatetags/by_mandate_url.py
memopol_representatives/templatetags/by_mandate_url.py
+3
-3
memopol_representatives/urls.py
memopol_representatives/urls.py
+2
-6
memopol_representatives/views.py
memopol_representatives/views.py
+15
-8
No files found.
memopol_representatives/templatetags/by_mandate_url.py
View file @
22fa8be1
...
...
@@ -9,11 +9,11 @@ def by_mandate_url(mandate):
kwargs
=
{
'mandate_kind'
:
mandate
.
group
.
kind
}
if
mandate
.
group
.
abbreviation
:
kwargs
[
'
mandate_abbr
'
]
=
mandate
.
group
.
abbreviation
kwargs
[
'
search
'
]
=
mandate
.
group
.
abbreviation
else
:
kwargs
[
'
mandate_name
'
]
=
mandate
.
group
.
name
kwargs
[
'
search
'
]
=
mandate
.
group
.
name
return
reverse
(
'representatives:list
by
'
,
'representatives:list'
,
kwargs
=
kwargs
)
memopol_representatives/urls.py
View file @
22fa8be1
...
...
@@ -5,11 +5,7 @@ from memopol_representatives import views
urlpatterns
=
patterns
(
''
,
url
(
r
'^$'
,
views
.
index
,
name
=
'index'
),
url
(
r
'^committee/(?P<mandate_abbr>\w{4})$'
,
views
.
by_mandate
,
{
'mandate_kind'
:
'committee'
},
name
=
'committee'
),
url
(
r
'^listby/(?P<mandate_kind>\w+)/a/(?P<mandate_abbr>.+)$'
,
views
.
by_mandate
,
name
=
'listby'
),
url
(
r
'^listby/(?P<mandate_kind>\w+)/n/(?P<mandate_name>.+)$'
,
views
.
by_mandate
,
name
=
'listby'
),
url
(
r
'^l/(?P<mandate_kind>\w+)/(?P<search>.+)$'
,
views
.
by_mandate
,
name
=
'list'
),
url
(
r
'^view/(?P<num>\d+)$'
,
views
.
view
,
name
=
'view'
),
)
memopol_representatives/views.py
View file @
22fa8be1
...
...
@@ -14,19 +14,26 @@ def index(request):
return
_render_list
(
request
,
representative_list
)
def
by_mandate
(
request
,
mandate_kind
,
mandate_abbr
=
None
,
mandate_name
=
None
):
representative_list
=
Representative
.
objects
.
filter
(
mandate__group__kind
=
mandate_kind
,
mandate__active
=
True
)
def
by_mandate
(
request
,
mandate_kind
,
mandate_abbr
=
None
,
mandate_name
=
None
,
search
=
None
):
if
mandate_abbr
:
representative_list
=
representative_list
.
filter
(
representative_list
=
Representative
.
objects
.
filter
(
mandate__group__abbreviation
=
mandate_abbr
,
mandate__group__kind
=
mandate_kind
,
mandate__active
=
True
)
if
mandate_name
:
representative_list
=
representative_list
.
filter
(
elif
mandate_name
:
representative_list
=
Representative
.
objects
.
filter
(
Q
(
mandate__group__name__icontains
=
mandate_name
),
mandate__group__kind
=
mandate_kind
,
mandate__active
=
True
)
elif
search
:
representative_list
=
Representative
.
objects
.
filter
(
Q
(
mandate__group__abbreviation__icontains
=
search
)
|
Q
(
mandate__group__name__icontains
=
search
),
mandate__group__kind
=
mandate_kind
,
mandate__active
=
True
)
...
...
Write
Preview
Markdown
is supported
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