Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
AE
Sith
Commits
349475cd
Commit
349475cd
authored
Jul 23, 2017
by
Sli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Functionnal search engine
parent
39616874
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
matmat/views.py
matmat/views.py
+5
-2
No files found.
matmat/views.py
View file @
349475cd
...
@@ -91,7 +91,6 @@ class SearchFormListView(WasSuscribed, SingleObjectMixin, ListView):
...
@@ -91,7 +91,6 @@ class SearchFormListView(WasSuscribed, SingleObjectMixin, ListView):
self
.
session
=
request
.
session
self
.
session
=
request
.
session
self
.
last_search
=
self
.
session
.
get
(
'matmat_search_result'
,
str
([]))
self
.
last_search
=
self
.
session
.
get
(
'matmat_search_result'
,
str
([]))
self
.
last_search
=
literal_eval
(
self
.
last_search
)
self
.
last_search
=
literal_eval
(
self
.
last_search
)
print
(
self
.
last_search
)
if
'valid_form'
in
kwargs
.
keys
():
if
'valid_form'
in
kwargs
.
keys
():
self
.
valid_form
=
kwargs
[
'valid_form'
]
self
.
valid_form
=
kwargs
[
'valid_form'
]
else
:
else
:
...
@@ -119,7 +118,11 @@ class SearchFormListView(WasSuscribed, SingleObjectMixin, ListView):
...
@@ -119,7 +118,11 @@ class SearchFormListView(WasSuscribed, SingleObjectMixin, ListView):
if
self
.
reverse
:
if
self
.
reverse
:
q
=
q
.
filter
(
phone
=
self
.
valid_form
[
'phone'
]).
all
()
q
=
q
.
filter
(
phone
=
self
.
valid_form
[
'phone'
]).
all
()
else
:
else
:
q
=
q
.
all
()
search_dict
=
{}
for
key
,
value
in
self
.
valid_form
.
items
():
if
key
!=
'phone'
and
not
(
value
==
''
or
value
is
None
or
value
==
'INDIFFERENT'
):
search_dict
[
key
+
"__icontains"
]
=
value
q
=
q
.
filter
(
**
search_dict
).
all
()
else
:
else
:
q
=
q
.
filter
(
pk__in
=
self
.
last_search
).
all
()
q
=
q
.
filter
(
pk__in
=
self
.
last_search
).
all
()
self
.
result_exists
=
q
.
exists
()
self
.
result_exists
=
q
.
exists
()
...
...
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