from django.contrib.auth.models import Permission

from rest_framework import viewsets

from .serializers import PermissionSerializer


class PermissionViewSet(viewsets.ReadOnlyModelViewSet):
    queryset = Permission.objects.all()
    serializer_class = PermissionSerializer

from django.contrib.auth.models import Permission

from rest_framework import viewsets

from .serializers import PermissionSerializer


class PermissionViewSet(viewsets.ReadOnlyModelViewSet):
    queryset = Permission.objects.all()
    serializer_class = PermissionSerializer
    search_fields = ('name',)

Add search functionality to permissions endpoint
Add search functionality to permissions endpoint

  from django.contrib.auth.models import Permission
  
  from rest_framework import viewsets
  
  from .serializers import PermissionSerializer
  
  
  class PermissionViewSet(viewsets.ReadOnlyModelViewSet):
      queryset = Permission.objects.all()
      serializer_class = PermissionSerializer
+     search_fields = ('name',)
  
Add search functionality to permissions endpoint
## Code Before:
from django.contrib.auth.models import Permission

from rest_framework import viewsets

from .serializers import PermissionSerializer


class PermissionViewSet(viewsets.ReadOnlyModelViewSet):
    queryset = Permission.objects.all()
    serializer_class = PermissionSerializer

## Instruction:
Add search functionality to permissions endpoint
## Code After:
from django.contrib.auth.models import Permission

from rest_framework import viewsets

from .serializers import PermissionSerializer


class PermissionViewSet(viewsets.ReadOnlyModelViewSet):
    queryset = Permission.objects.all()
    serializer_class = PermissionSerializer
    search_fields = ('name',)
