Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
dashboard
Commits
760175eb
Commit
760175eb
authored
Mar 06, 2019
by
Guilhem Saurel
Browse files
filter_valid_name: __icontains
parent
35b530ae
Pipeline
#3331
passed with stages
in 9 minutes and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rainboard/filters.py
View file @
760175eb
...
...
@@ -4,11 +4,11 @@ from . import models, utils
def
filter_valid_name
(
queryset
,
name
,
value
):
return
queryset
.
filter
(
**
{
name
:
utils
.
valid_name
(
value
)})
return
queryset
.
filter
(
**
{
f
'
{
name
}
__icontains'
:
utils
.
valid_name
(
value
)})
class
ProjectFilter
(
django_filters
.
rest_framework
.
FilterSet
):
name
=
django_filters
.
CharFilter
(
lookup_expr
=
'icontains'
,
method
=
filter_valid_name
)
name
=
django_filters
.
CharFilter
(
method
=
filter_valid_name
)
class
Meta
:
model
=
models
.
Project
...
...
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