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
a11eceb7
Commit
a11eceb7
authored
Apr 24, 2017
by
alexandre.jauneau
Browse files
Fix PEP8
parent
53b0ea31
Pipeline
#995
failed with stage
in 10 minutes and 38 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/memopol/utils.py
View file @
a11eceb7
import
unicodedata
def
strip_accents
(
value
):
return
''
.
join
(
c
for
c
in
unicodedata
.
normalize
(
'NFD'
,
value
)
if
unicodedata
.
category
(
c
)
!=
'Mn'
)
return
''
.
join
(
c
for
c
in
unicodedata
.
normalize
(
'NFD'
,
value
)
if
unicodedata
.
category
(
c
)
!=
'Mn'
)
src/memopol/views/representative_search.py
View file @
a11eceb7
...
...
@@ -4,6 +4,7 @@ from haystack.query import SearchQuerySet
from
django.core.urlresolvers
import
reverse
from
memopol.utils
import
strip_accents
def
search_autocomplete
(
request
):
if
request
.
is_ajax
():
q
=
strip_accents
(
request
.
GET
.
get
(
'term'
,
''
))
...
...
@@ -15,7 +16,8 @@ def search_autocomplete(request):
result_json
[
'id'
]
=
result
.
id
result_json
[
'label'
]
=
result
.
full_name
result_json
[
'value'
]
=
result
.
full_name
result_json
[
'link'
]
=
reverse
(
'representative-detail'
,
kwargs
=
{
'slug'
:
result
.
slug
})
result_json
[
'link'
]
=
reverse
(
'representative-detail'
,
kwargs
=
{
'slug'
:
result
.
slug
})
json_results
.
append
(
result_json
)
data
=
json
.
dumps
(
json_results
)
else
:
...
...
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