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
AE UTBM
Sith
Commits
c1397ef5
Commit
c1397ef5
authored
Dec 08, 2016
by
Skia
🤘
Browse files
Small fix, episode two
parent
9847186b
Pipeline
#481
passed with stage
in 2 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/views/site.py
View file @
c1397ef5
...
@@ -23,7 +23,7 @@ def search_user(query, as_json=False):
...
@@ -23,7 +23,7 @@ def search_user(query, as_json=False):
users
=
User
.
objects
.
filter
(
Q
(
first_name__icontains
=
query
)
|
users
=
User
.
objects
.
filter
(
Q
(
first_name__icontains
=
query
)
|
Q
(
last_name__icontains
=
query
)).
exclude
(
id__in
=
exact_nick
).
exclude
(
id__in
=
nicks
).
all
()
Q
(
last_name__icontains
=
query
)).
exclude
(
id__in
=
exact_nick
).
exclude
(
id__in
=
nicks
).
all
()
nicks
=
nicks
[:
5
]
nicks
=
nicks
[:
5
]
users
=
users
[:
5
]
users
=
users
[:
5
0
]
if
as_json
:
# Re-loads json to avoid double encoding by JsonResponse, but still benefit from serializers
if
as_json
:
# Re-loads json to avoid double encoding by JsonResponse, but still benefit from serializers
exact_nick
=
json
.
loads
(
serializers
.
serialize
(
'json'
,
exact_nick
,
fields
=
(
'nick_name'
,
'last_name'
,
'first_name'
,
'profile_pict'
)))
exact_nick
=
json
.
loads
(
serializers
.
serialize
(
'json'
,
exact_nick
,
fields
=
(
'nick_name'
,
'last_name'
,
'first_name'
,
'profile_pict'
)))
nicks
=
json
.
loads
(
serializers
.
serialize
(
'json'
,
nicks
,
fields
=
(
'nick_name'
,
'last_name'
,
'first_name'
,
'profile_pict'
)))
nicks
=
json
.
loads
(
serializers
.
serialize
(
'json'
,
nicks
,
fields
=
(
'nick_name'
,
'last_name'
,
'first_name'
,
'profile_pict'
)))
...
...
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