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(
class APIImageViewSet(viewsets.ModelViewSet):
serializer_class = ImageSerializer
pagination_class = LimitOffsetPagination
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
def get_queryset(self):
"""The queryset contains all the images if the method is safe, otherwise it only contains
......@@ -336,6 +337,7 @@ class APIImageViewSet(viewsets.ModelViewSet):
serializer = ImageSerializer(
image,
context={"request": request}, # the serializer needs the request in the context
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