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):
|
def with_es_related(self):
|
||||||
"""Returns qs with related for ES indexing."""
|
"""Returns qs with related for ES indexing."""
|
||||||
return self.with_base_related().prefetch_related('tags', 'classifications', 'classifications__tags',
|
return self.with_base_related()\
|
||||||
'classifications__type', 'classifications_standard',
|
.prefetch_related('tags', 'standards','classifications', 'classifications__standard',
|
||||||
'standards').select_related('wine_region', 'wine_sub_region')
|
'classifications__classification_type','classifications__tags')\
|
||||||
|
.select_related('wine_region', 'wine_sub_region')
|
||||||
|
|
||||||
def common(self):
|
def common(self):
|
||||||
return self.filter(category=self.model.COMMON)
|
return self.filter(category=self.model.COMMON)
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,7 @@ class ProductSubtypeDocumentSerializer(serializers.Serializer):
|
||||||
id = serializers.IntegerField()
|
id = serializers.IntegerField()
|
||||||
name_translated = serializers.SerializerMethodField()
|
name_translated = serializers.SerializerMethodField()
|
||||||
|
|
||||||
@staticmethod
|
get_name_translated = lambda obj: get_translated_value(obj.name)
|
||||||
def get_name_translted(obj):
|
|
||||||
return get_translated_value(obj.name)
|
|
||||||
|
|
||||||
|
|
||||||
class WineRegionCountryDocumentSerialzer(serializers.Serializer):
|
class WineRegionCountryDocumentSerialzer(serializers.Serializer):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user