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
dc571836
Commit
dc571836
authored
Jul 23, 2017
by
Sli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issues with department and sex form
parent
86d62f12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
matmat/templates/matmat/search_form.jinja
matmat/templates/matmat/search_form.jinja
+2
-0
matmat/views.py
matmat/views.py
+9
-3
No files found.
matmat/templates/matmat/search_form.jinja
View file @
dc571836
...
...
@@ -56,6 +56,7 @@
{{
form.phone.errors
}}
<label
for=
"
{{
form.phone.id_for_label
}}
"
>
{{
form.phone.label
}}
</label>
{{
form.phone
}}
{{
form.sex.as_hidden
()
}}
<p><input
type=
"submit"
value=
"
{%
trans
%}
Search
{%
endtrans
%}
"
/></p>
</p>
</form>
...
...
@@ -65,6 +66,7 @@
<p>
{{
form.quick.errors
}}
<label
for=
"
{{
form.quick.id_for_label
}}
"
>
{{
form.quick.label
}}
</label>
{{
form.sex.as_hidden
()
}}
{{
form.quick
}}
<p><input
type=
"submit"
value=
"
{%
trans
%}
Search
{%
endtrans
%}
"
/></p>
</p>
...
...
matmat/views.py
View file @
dc571836
...
...
@@ -134,8 +134,11 @@ class SearchFormListView(WasSuscribed, SingleObjectMixin, ListView):
if
self
.
search_type
==
SearchType
.
REVERSE
:
q
=
q
.
filter
(
phone
=
self
.
valid_form
[
'phone'
]).
all
()
elif
self
.
search_type
==
SearchType
.
QUICK
:
q
=
search_user
(
self
.
valid_form
[
'quick'
])
if
not
self
.
can_see_hidden
:
if
self
.
valid_form
[
'quick'
].
strip
():
q
=
search_user
(
self
.
valid_form
[
'quick'
])
else
:
q
=
[]
if
not
self
.
can_see_hidden
and
len
(
q
)
>
0
:
q
=
[
user
for
user
in
q
if
user
.
is_subscriber_viewable
]
else
:
search_dict
=
{}
...
...
@@ -182,7 +185,10 @@ class SearchFormView(WasSuscribed, FormView):
return
view
(
request
,
*
args
,
**
kwargs
)
def
get_initial
(
self
):
return
self
.
session
.
get
(
'matmat_search_form'
,
{})
init
=
self
.
session
.
get
(
'matmat_search_form'
,
{})
if
not
init
:
init
[
'department'
]
=
''
return
init
class
SearchNormalFormView
(
SearchFormView
):
...
...
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