diff --git a/apps/collection/models.py b/apps/collection/models.py index c5d55848..b37b6a14 100644 --- a/apps/collection/models.py +++ b/apps/collection/models.py @@ -170,7 +170,7 @@ class GuideQuerySet(models.QuerySet): def with_base_related(self): """Return QuerySet with related.""" - return self.select_related('site', ) + return self.select_related('site', 'guidefilter',) def with_extended_related(self): """Return QuerySet with extended related.""" diff --git a/apps/collection/views/back.py b/apps/collection/views/back.py index fabc8eb7..ba0a25b0 100644 --- a/apps/collection/views/back.py +++ b/apps/collection/views/back.py @@ -30,10 +30,10 @@ class GuideBaseView(generics.GenericAPIView): def get_queryset(self): """An overridden get_queryset method.""" - return ( - models.Guide.objects.with_extended_related() - # .annotate_counters() - ) + queryset = models.Guide.objects.with_extended_related + if hasattr(self.request, 'country_code'): + return queryset().by_country_code(self.request.country_code) + return queryset() class GuideFilterBaseView(generics.GenericAPIView):