distillery_type
This commit is contained in:
parent
7ce25a41c8
commit
59f7f8d2d4
|
|
@ -784,6 +784,10 @@ class Establishment(GalleryMixin, ProjectBaseMixin, URLImageMixin,
|
||||||
def artisan_category_indexing(self):
|
def artisan_category_indexing(self):
|
||||||
return self.tags.filter(category__index_name='shop_category')
|
return self.tags.filter(category__index_name='shop_category')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def distillery_type_indexing(self):
|
||||||
|
return self.tags.filter(category__index_name='distillery_type')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def last_comment(self):
|
def last_comment(self):
|
||||||
if hasattr(self, 'comments_prefetched') and len(self.comments_prefetched):
|
if hasattr(self, 'comments_prefetched') and len(self.comments_prefetched):
|
||||||
|
|
@ -854,11 +858,6 @@ class Establishment(GalleryMixin, ProjectBaseMixin, URLImageMixin,
|
||||||
metadata.append(category_tags)
|
metadata.append(category_tags)
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
@property
|
|
||||||
def distillery_types(self):
|
|
||||||
"""Tags from tag category - distillery_type."""
|
|
||||||
return self.tags.filter(category__index_name='distillery_type')
|
|
||||||
|
|
||||||
|
|
||||||
class EstablishmentNoteQuerySet(models.QuerySet):
|
class EstablishmentNoteQuerySet(models.QuerySet):
|
||||||
"""QuerySet for model EstablishmentNote."""
|
"""QuerySet for model EstablishmentNote."""
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ class EstablishmentBaseSerializer(ProjectModelSerializer):
|
||||||
read_only=True)
|
read_only=True)
|
||||||
tz = serializers.CharField(read_only=True, source='timezone_as_str')
|
tz = serializers.CharField(read_only=True, source='timezone_as_str')
|
||||||
new_image = ImageBaseSerializer(source='crop_main_image', allow_null=True, read_only=True)
|
new_image = ImageBaseSerializer(source='crop_main_image', allow_null=True, read_only=True)
|
||||||
distillery_types = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
distillery_type = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
"""Meta class."""
|
"""Meta class."""
|
||||||
|
|
@ -353,7 +353,7 @@ class EstablishmentBaseSerializer(ProjectModelSerializer):
|
||||||
'new_image',
|
'new_image',
|
||||||
'tz',
|
'tz',
|
||||||
'wine_regions',
|
'wine_regions',
|
||||||
'distillery_types',
|
'distillery_type',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -365,6 +365,7 @@ class EstablishmentListRetrieveSerializer(EstablishmentBaseSerializer):
|
||||||
restaurant_category = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
restaurant_category = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||||
restaurant_cuisine = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
restaurant_cuisine = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||||
artisan_category = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
artisan_category = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||||
|
distillery_type = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||||
|
|
||||||
class Meta(EstablishmentBaseSerializer.Meta):
|
class Meta(EstablishmentBaseSerializer.Meta):
|
||||||
"""Meta class."""
|
"""Meta class."""
|
||||||
|
|
@ -374,6 +375,7 @@ class EstablishmentListRetrieveSerializer(EstablishmentBaseSerializer):
|
||||||
'restaurant_category',
|
'restaurant_category',
|
||||||
'restaurant_cuisine',
|
'restaurant_cuisine',
|
||||||
'artisan_category',
|
'artisan_category',
|
||||||
|
'distillery_type',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -467,6 +469,7 @@ class EstablishmentSimilarSerializer(EstablishmentBaseSerializer):
|
||||||
artisan_category = TagBaseSerializer(many=True, allow_null=True, read_only=True)
|
artisan_category = TagBaseSerializer(many=True, allow_null=True, read_only=True)
|
||||||
restaurant_category = TagBaseSerializer(many=True, allow_null=True, read_only=True)
|
restaurant_category = TagBaseSerializer(many=True, allow_null=True, read_only=True)
|
||||||
restaurant_cuisine = TagBaseSerializer(many=True, allow_null=True, read_only=True)
|
restaurant_cuisine = TagBaseSerializer(many=True, allow_null=True, read_only=True)
|
||||||
|
distillery_type = TagBaseSerializer(many=True, allow_null=True, read_only=True)
|
||||||
|
|
||||||
class Meta(EstablishmentBaseSerializer.Meta):
|
class Meta(EstablishmentBaseSerializer.Meta):
|
||||||
fields = EstablishmentBaseSerializer.Meta.fields + [
|
fields = EstablishmentBaseSerializer.Meta.fields + [
|
||||||
|
|
@ -475,6 +478,7 @@ class EstablishmentSimilarSerializer(EstablishmentBaseSerializer):
|
||||||
'artisan_category',
|
'artisan_category',
|
||||||
'restaurant_category',
|
'restaurant_category',
|
||||||
'restaurant_cuisine',
|
'restaurant_cuisine',
|
||||||
|
'distillery_type',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ class EstablishmentListView(EstablishmentMixinView, generics.ListAPIView):
|
||||||
.with_extended_address_related().with_currency_related() \
|
.with_extended_address_related().with_currency_related() \
|
||||||
.with_certain_tag_category_related('category', 'restaurant_category') \
|
.with_certain_tag_category_related('category', 'restaurant_category') \
|
||||||
.with_certain_tag_category_related('cuisine', 'restaurant_cuisine') \
|
.with_certain_tag_category_related('cuisine', 'restaurant_cuisine') \
|
||||||
.with_certain_tag_category_related('shop_category', 'artisan_category')
|
.with_certain_tag_category_related('shop_category', 'artisan_category') \
|
||||||
|
.with_certain_tag_category_related('distillery_type', 'distillery_type')
|
||||||
|
|
||||||
|
|
||||||
class EstablishmentSimilarView(EstablishmentListView):
|
class EstablishmentSimilarView(EstablishmentListView):
|
||||||
|
|
|
||||||
|
|
@ -77,15 +77,15 @@ class EstablishmentDocument(Document):
|
||||||
'value': fields.KeywordField(),
|
'value': fields.KeywordField(),
|
||||||
},
|
},
|
||||||
multi=True, attr='artisan_category_indexing')
|
multi=True, attr='artisan_category_indexing')
|
||||||
visible_tags = fields.ObjectField(
|
distillery_type = fields.ObjectField(
|
||||||
properties={
|
properties={
|
||||||
'id': fields.IntegerField(attr='id'),
|
'id': fields.IntegerField(attr='id'),
|
||||||
'label': fields.ObjectField(attr='label_indexing',
|
'label': fields.ObjectField(attr='label_indexing',
|
||||||
properties=OBJECT_FIELD_PROPERTIES),
|
properties=OBJECT_FIELD_PROPERTIES),
|
||||||
'value': fields.KeywordField(),
|
'value': fields.KeywordField(),
|
||||||
},
|
},
|
||||||
multi=True)
|
multi=True, attr='distillery_type_indexing')
|
||||||
distillery_types = fields.ObjectField(
|
visible_tags = fields.ObjectField(
|
||||||
properties={
|
properties={
|
||||||
'id': fields.IntegerField(attr='id'),
|
'id': fields.IntegerField(attr='id'),
|
||||||
'label': fields.ObjectField(attr='label_indexing',
|
'label': fields.ObjectField(attr='label_indexing',
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ class EstablishmentDocumentSerializer(InFavoritesMixin, DocumentSerializer):
|
||||||
tags = TagsDocumentSerializer(many=True, source='visible_tags')
|
tags = TagsDocumentSerializer(many=True, source='visible_tags')
|
||||||
restaurant_category = TagsDocumentSerializer(many=True, allow_null=True)
|
restaurant_category = TagsDocumentSerializer(many=True, allow_null=True)
|
||||||
restaurant_cuisine = TagsDocumentSerializer(many=True, allow_null=True)
|
restaurant_cuisine = TagsDocumentSerializer(many=True, allow_null=True)
|
||||||
distillery_types = TagsDocumentSerializer(many=True, allow_null=True)
|
distillery_type = TagsDocumentSerializer(many=True, allow_null=True)
|
||||||
artisan_category = TagsDocumentSerializer(many=True, allow_null=True)
|
artisan_category = TagsDocumentSerializer(many=True, allow_null=True)
|
||||||
schedule = ScheduleDocumentSerializer(many=True, allow_null=True)
|
schedule = ScheduleDocumentSerializer(many=True, allow_null=True)
|
||||||
wine_origins = WineOriginSerializer(many=True)
|
wine_origins = WineOriginSerializer(many=True)
|
||||||
|
|
@ -311,7 +311,7 @@ class EstablishmentDocumentSerializer(InFavoritesMixin, DocumentSerializer):
|
||||||
# 'collections',
|
# 'collections',
|
||||||
'type',
|
'type',
|
||||||
'subtypes',
|
'subtypes',
|
||||||
'distillery_types',
|
'distillery_type',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user