views.py 452 B

12345678910111213141516
  1. from rest_framework import viewsets
  2. from rest_framework.filters import OrderingFilter
  3. from .models import Organization
  4. from .serializers.serializers import (
  5. OrganizationSerializer,
  6. )
  7. class OrganizationViewSet(viewsets.GenericViewSet):
  8. filter_backends = [OrderingFilter]
  9. ordering = ["name"]
  10. ordering_fields = ["name"]
  11. queryset = Organization.objects.none()
  12. serializer_class = OrganizationSerializer
  13. lookup_field = "slug"