You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
371 B
Python
15 lines
371 B
Python
2 years ago
|
import django_filters
|
||
|
from django_filters.rest_framework import FilterSet
|
||
|
|
||
|
from event.models import Event
|
||
|
|
||
|
|
||
|
class EventFilter(FilterSet):
|
||
|
event_name = django_filters.CharFilter(field_name='event_name', lookup_expr='icontains')
|
||
|
|
||
|
class Meta:
|
||
|
# 指定模型
|
||
|
models = Event
|
||
|
# 指定需要模糊查询的字段
|
||
|
fields = ("event_name",)
|