Skip to content

Commit

Permalink
Optimize website serializer query
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmesami committed May 19, 2024
1 parent 87f3ba1 commit 0cee51c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tumbs/websites/api/websites/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ class WebsiteSerializer(serializers.ModelSerializer):
images = serializers.SerializerMethodField()

def get_pages(self, obj):
qs = obj.pages.valid()
serializer = PageSerializer(qs, many=True)
serializer = PageSerializer(obj.pages, many=True)
return serializer.data

def get_images(self, obj):
qs = obj.images.valid()
serializer = ImageSerializer(qs, many=True)
serializer = ImageSerializer(obj.images, many=True)
return serializer.data

class Meta:
Expand Down

0 comments on commit 0cee51c

Please sign in to comment.