tickets.py 944 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. from rest_framework import generics, permissions
  2. from rest_framework_api_key.permissions import HasAPIKey
  3. from tickets.api.v2.serializers.tickets import TicketSerializer
  4. from tickets.models import Ticket
  5. class TicketPatchAPIView(generics.UpdateAPIView):
  6. """
  7. API для частичного обновления тикета
  8. """
  9. queryset = Ticket.objects.all()
  10. serializer_class = TicketSerializer
  11. permission_classes = [
  12. permissions.IsAuthenticated | HasAPIKey
  13. ]
  14. class TicketListAPIView(generics.ListAPIView):
  15. """
  16. API для получения списка тикетов
  17. """
  18. queryset = Ticket.objects.all()
  19. serializer_class = TicketSerializer
  20. permission_classes = [
  21. permissions.IsAuthenticated | HasAPIKey
  22. ]
  23. filterset_fields = (
  24. 'title',
  25. 'ticket_list',
  26. 'ticket_type',
  27. 'status',
  28. 'created_by',
  29. 'assigned_to',
  30. )