Skip to content

Commit

Permalink
feat: изменены пермишены и добавлен сериализатор.
Browse files Browse the repository at this point in the history
  • Loading branch information
menma331 committed Feb 19, 2024
1 parent c2579ba commit ac3bfca
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions delivers/views/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,26 @@
)
class DeliveryViewSet(CRUDListViewSet):
"""Представление доставки."""

queryset = Delivery.objects.all()

permission_classes = (permissions.IsAuthenticated, )
permission_classes = (permissions.IsAuthenticated,)

multi_permission_classes = {
'create': (permissions.IsAdminUser,),
'retrieve': (permissions.AllowAny,),
'partial_update': (permissions.IsAdminUser,),
'destroy': (permissions.IsAdminUser,),
'list': (permissions.AllowAny,)
}

serializer_class = delivery_s.DeliveryListSerializer

http_method_names = ('get', 'post', 'patch', 'delete')

multi_serializer_class = {
'create': delivery_s.DeliveryCreateSerializer,
'retrieve': delivery_s.DeliveryRetrieveSerializer,
'partial_update': delivery_s.DeliveryStatusUpdateSerializer,
'destroy': delivery_s.DeliveryDeleteSerializer
'destroy': delivery_s.DeliveryDeleteSerializer,
'list': delivery_s.DeliveryListSerializer
}

0 comments on commit ac3bfca

Please sign in to comment.