diff --git a/market/viewsets.py b/market/viewsets.py index fb21962..97d0667 100644 --- a/market/viewsets.py +++ b/market/viewsets.py @@ -1,5 +1,5 @@ from rest_framework.decorators import action -from rest_framework.permissions import AllowAny, IsAdminUser, IsAuthenticated +from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet @@ -52,7 +52,12 @@ class ProductViewset(ActionBasedMixin, ModelViewSet): class PostViewset(ActionBasedMixin, ModelViewSet): - queryset = Post.objects.all() + queryset = Post.objects.all().select_related( + "storage", + "product", + "author", + "product__brand", + ) serializer_class = PostSerializer permission_classes = [IsAuthenticated, IsAuthorOrReadOnly] permission_classes_map = {