Fix ES product relations & swagger
This commit is contained in:
parent
2ca4ab6bb5
commit
36f4ab1dd9
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user