Skip to content
Snippets Groups Projects
Verified Commit 18d962d4 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: use different permission & add request to context for images

parent bceb35df
No related branches found
No related tags found
No related merge requests found
...@@ -307,6 +307,7 @@ class APIUserViewSet( ...@@ -307,6 +307,7 @@ class APIUserViewSet(
class APIImageViewSet(viewsets.ModelViewSet): class APIImageViewSet(viewsets.ModelViewSet):
serializer_class = ImageSerializer serializer_class = ImageSerializer
pagination_class = LimitOffsetPagination pagination_class = LimitOffsetPagination
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
def get_queryset(self): def get_queryset(self):
"""The queryset contains all the images if the method is safe, otherwise it only contains """The queryset contains all the images if the method is safe, otherwise it only contains
...@@ -336,6 +337,7 @@ class APIImageViewSet(viewsets.ModelViewSet): ...@@ -336,6 +337,7 @@ class APIImageViewSet(viewsets.ModelViewSet):
serializer = ImageSerializer( serializer = ImageSerializer(
image, image,
context={"request": request}, # the serializer needs the request in the context
data=request.data, data=request.data,
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment