Merge branch 'feature/establishment_by_slug_by_country_fix' into 'develop'
Establishments/slug/<slug> fix See merge request gm/gm-backend!57
This commit is contained in:
commit
5afc257c13
|
|
@ -19,9 +19,12 @@ class EstablishmentMixinView:
|
|||
|
||||
def get_queryset(self):
|
||||
"""Overridden method 'get_queryset'."""
|
||||
return models.Establishment.objects.published() \
|
||||
qs = models.Establishment.objects.published() \
|
||||
.with_base_related() \
|
||||
.annotate_in_favorites(self.request.user)
|
||||
if self.request.country_code:
|
||||
qs = qs.by_country_code(self.request.country_code)
|
||||
return qs
|
||||
|
||||
|
||||
class EstablishmentListView(EstablishmentMixinView, generics.ListAPIView):
|
||||
|
|
@ -30,13 +33,6 @@ class EstablishmentListView(EstablishmentMixinView, generics.ListAPIView):
|
|||
filter_class = filters.EstablishmentFilter
|
||||
serializer_class = serializers.EstablishmentBaseSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
"""Overridden method 'get_queryset'."""
|
||||
qs = super(EstablishmentListView, self).get_queryset()
|
||||
if self.request.country_code:
|
||||
qs = qs.by_country_code(self.request.country_code)
|
||||
return qs
|
||||
|
||||
|
||||
class EstablishmentRetrieveView(EstablishmentMixinView, generics.RetrieveAPIView):
|
||||
"""Resource for getting a establishment."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user