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
Political Memory
memopol
Commits
5f31138e
Commit
5f31138e
authored
Dec 17, 2015
by
Nicolas Joyard
Committed by
Jamesie Pic
Jan 12, 2016
Browse files
Use slug to search for reps, enables searching through accents
parent
3ceda99d
Changes
1
Hide whitespace changes
Inline
Side-by-side
legislature/views/representative.py
View file @
5f31138e
...
...
@@ -25,6 +25,7 @@ from datetime import datetime
from
django.db.models
import
Q
from
django.http
import
Http404
from
django.shortcuts
import
render
from
django.utils.text
import
slugify
from
core.utils
import
render_paginate_list
from
positions.forms
import
PositionForm
...
...
@@ -119,7 +120,7 @@ def _filter_by_search(request, representative_list):
search
=
request
.
GET
.
get
(
'search'
)
if
search
:
return
representative_list
.
filter
(
Q
(
full_name
__icontains
=
search
)
Q
(
slug
__icontains
=
slugify
(
search
)
)
)
else
:
return
representative_list
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