fix product in_fav

This commit is contained in:
alex 2019-11-15 10:53:28 +03:00
parent 0dbb2c64cd
commit 4d302395a9

View File

@ -10,12 +10,13 @@ from comment.serializers import CommentRUDSerializer
class ProductBaseView(generics.GenericAPIView):
"""Product base view"""
permission_classes = (permissions.AllowAny, )
permission_classes = (permissions.AllowAny,)
def get_queryset(self):
"""Override get_queryset method."""
return Product.objects.published() \
.with_base_related() \
.annotate_in_favorites(self.request.user) \
.by_country_code(self.request.country_code) \
.order_by('-created')
@ -67,8 +68,8 @@ class ProductCommentListView(generics.ListAPIView):
"""Override get_queryset method"""
product = get_object_or_404(Product, slug=self.kwargs['slug'])
return Comment.objects.by_content_type(app_label='product',
model='product')\
.by_object_id(object_id=product.pk)\
model='product') \
.by_object_id(object_id=product.pk) \
.order_by('-created')