feat(orgs): relation 增加搜索功能

pull/4939/head
xinwen 2020-11-02 16:40:51 +08:00 committed by 老广
parent 44d9aff573
commit 0390e37fd5
1 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,7 @@
# #
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.db.models import Q
from rest_framework import status from rest_framework import status
from rest_framework.views import Response from rest_framework.views import Response
from rest_framework_bulk import BulkModelViewSet from rest_framework_bulk import BulkModelViewSet
@ -72,6 +73,7 @@ class OrgMemberRelationBulkViewSet(JMSBulkRelationModelViewSet):
m2m_field = Organization.members.field m2m_field = Organization.members.field
serializer_class = OrgMemberSerializer serializer_class = OrgMemberSerializer
filterset_class = OrgMemberRelationFilterSet filterset_class = OrgMemberRelationFilterSet
search_fields = ('user__name', 'user__username', 'org__name')
def perform_bulk_create(self, serializer): def perform_bulk_create(self, serializer):
data = serializer.validated_data data = serializer.validated_data