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

fix: don’t limit the image queryset for superusers

parent e6022680
No related branches found
No related tags found
No related merge requests found
Pipeline #7592 passed
...@@ -307,9 +307,13 @@ class APIImageViewSet(viewsets.ModelViewSet): ...@@ -307,9 +307,13 @@ class APIImageViewSet(viewsets.ModelViewSet):
pagination_class = LimitOffsetPagination pagination_class = LimitOffsetPagination
def get_queryset(self): def get_queryset(self):
"""The queryset contains only images owned by the requesting user.""" """The queryset contains all the images if the requesting user is superuser, otherwise it
only includes the images owned by the requesting user."""
return Image.objects.filter(owner=self.request.user.username) if self.request.user.is_superuser:
return Image.objects.all()
else:
return Image.objects.filter(owner=self.request.user.username)
def create(self, request, *args, **kwargs): def create(self, request, *args, **kwargs):
"""Create an Image instance. Any user can create an image.""" """Create an Image instance. Any user can create an image."""
......
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