From ca08005dc97902797a4b002ee025e883913e2d3f Mon Sep 17 00:00:00 2001 From: bios000 <3540970872@qq.com> Date: Fri, 21 Apr 2023 17:16:25 +0800 Subject: [PATCH] =?UTF-8?q?domain=20=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E6=A0=87=E5=87=86=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/message/serializers.py | 4 ++-- utils/helper.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/message/serializers.py b/modules/message/serializers.py index b3a36df..1f8d13c 100644 --- a/modules/message/serializers.py +++ b/modules/message/serializers.py @@ -1,7 +1,7 @@ import django_filters from rest_framework import serializers from modules.message.models import Message -from utils.helper import get_message_type_name +from utils.helper import get_message_type_name, ListFilter class MessageSerializer(serializers.ModelSerializer): @@ -19,7 +19,7 @@ def get_message_type(self, obj): class MessageFilter(django_filters.FilterSet): month = django_filters.NumberFilter(field_name='create_time', lookup_expr='month') year = django_filters.NumberFilter(field_name='create_time', lookup_expr='year') - domain_in = django_filters.CharFilter(field_name='domain', lookup_expr='in') + domain = ListFilter(query_param='domain') content_contains = django_filters.CharFilter(field_name='content', lookup_expr='icontains') domain_contains = django_filters.CharFilter(field_name='domain', lookup_expr='icontains') order_desc = django_filters.CharFilter(method='order_by_desc', initial='desc') diff --git a/utils/helper.py b/utils/helper.py index 80c8cef..b3e49d8 100644 --- a/utils/helper.py +++ b/utils/helper.py @@ -268,3 +268,5 @@ def get_lastest_verson(): print(f"Latest version on GitHub: {latest_version}") return latest_version + +