Skip to content

Commit

Permalink
domain 列表查询方式标准化
Browse files Browse the repository at this point in the history
  • Loading branch information
bios000 committed Apr 21, 2023
1 parent f4c5c42 commit ca08005
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/message/serializers.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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')
Expand Down
2 changes: 2 additions & 0 deletions utils/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,5 @@ def get_lastest_verson():
print(f"Latest version on GitHub: {latest_version}")

return latest_version


0 comments on commit ca08005

Please sign in to comment.