diff --git a/apps/product/models.py b/apps/product/models.py index e0e80320..6065871c 100644 --- a/apps/product/models.py +++ b/apps/product/models.py @@ -80,9 +80,10 @@ class ProductQuerySet(models.QuerySet): def with_es_related(self): """Returns qs with related for ES indexing.""" - return self.with_base_related().prefetch_related('tags', 'classifications', 'classifications__tags', - 'classifications__type', 'classifications_standard', - 'standards').select_related('wine_region', 'wine_sub_region') + return self.with_base_related()\ + .prefetch_related('tags', 'standards','classifications', 'classifications__standard', + 'classifications__classification_type','classifications__tags')\ + .select_related('wine_region', 'wine_sub_region') def common(self): return self.filter(category=self.model.COMMON) diff --git a/apps/search_indexes/serializers.py b/apps/search_indexes/serializers.py index e83e8413..799e90eb 100644 --- a/apps/search_indexes/serializers.py +++ b/apps/search_indexes/serializers.py @@ -26,9 +26,7 @@ class ProductSubtypeDocumentSerializer(serializers.Serializer): id = serializers.IntegerField() name_translated = serializers.SerializerMethodField() - @staticmethod - def get_name_translted(obj): - return get_translated_value(obj.name) + get_name_translated = lambda obj: get_translated_value(obj.name) class WineRegionCountryDocumentSerialzer(serializers.Serializer):