Browse Source

Enable to search projects

pull/1668/head
Hironsan 2 years ago
parent
commit
11d5c4acda
1 changed files with 4 additions and 1 deletions
  1. 5
      backend/api/views/project.py

5
backend/api/views/project.py

@ -1,5 +1,6 @@
from django.conf import settings from django.conf import settings
from rest_framework import generics, status
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters, generics, status
from rest_framework.permissions import IsAdminUser, IsAuthenticated from rest_framework.permissions import IsAdminUser, IsAuthenticated
from rest_framework.response import Response from rest_framework.response import Response
@ -11,6 +12,8 @@ from ..serializers import ProjectPolymorphicSerializer
class ProjectList(generics.ListCreateAPIView): class ProjectList(generics.ListCreateAPIView):
serializer_class = ProjectPolymorphicSerializer serializer_class = ProjectPolymorphicSerializer
filter_backends = (DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter)
search_fields = ('name', 'description')
def get_permissions(self): def get_permissions(self):
if self.request.method == 'GET': if self.request.method == 'GET':

Loading…
Cancel
Save