Commit 35b530ae authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

filter_valid_name

parent 32aa1312
Pipeline #3168 passed with stages
in 6 minutes and 53 seconds
import django_filters
from . import models
from . import models, utils
def filter_valid_name(queryset, name, value):
return queryset.filter(**{name: utils.valid_name(value)})
class ProjectFilter(django_filters.rest_framework.FilterSet):
name = django_filters.CharFilter(lookup_expr='icontains')
name = django_filters.CharFilter(lookup_expr='icontains', method=filter_valid_name)
class Meta:
model = models.Project
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment