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):
|
||||
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
|
||||
def last_comment(self):
|
||||
if hasattr(self, 'comments_prefetched') and len(self.comments_prefetched):
|
||||
|
|
@ -854,11 +858,6 @@ class Establishment(GalleryMixin, ProjectBaseMixin, URLImageMixin,
|
|||
metadata.append(category_tags)
|
||||
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):
|
||||
"""QuerySet for model EstablishmentNote."""
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ class EstablishmentBaseSerializer(ProjectModelSerializer):
|
|||
read_only=True)
|
||||
tz = serializers.CharField(read_only=True, source='timezone_as_str')
|
||||
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:
|
||||
"""Meta class."""
|
||||
|
|
@ -353,7 +353,7 @@ class EstablishmentBaseSerializer(ProjectModelSerializer):
|
|||
'new_image',
|
||||
'tz',
|
||||
'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_cuisine = 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):
|
||||
"""Meta class."""
|
||||
|
|
@ -374,6 +375,7 @@ class EstablishmentListRetrieveSerializer(EstablishmentBaseSerializer):
|
|||
'restaurant_category',
|
||||
'restaurant_cuisine',
|
||||
'artisan_category',
|
||||
'distillery_type',
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -467,6 +469,7 @@ class EstablishmentSimilarSerializer(EstablishmentBaseSerializer):
|
|||
artisan_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)
|
||||
distillery_type = TagBaseSerializer(many=True, allow_null=True, read_only=True)
|
||||
|
||||
class Meta(EstablishmentBaseSerializer.Meta):
|
||||
fields = EstablishmentBaseSerializer.Meta.fields + [
|
||||
|
|
@ -475,6 +478,7 @@ class EstablishmentSimilarSerializer(EstablishmentBaseSerializer):
|
|||
'artisan_category',
|
||||
'restaurant_category',
|
||||
'restaurant_cuisine',
|
||||
'distillery_type',
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ class EstablishmentListView(EstablishmentMixinView, generics.ListAPIView):
|
|||
.with_extended_address_related().with_currency_related() \
|
||||
.with_certain_tag_category_related('category', 'restaurant_category') \
|
||||
.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):
|
||||
|
|
|
|||
|
|
@ -77,15 +77,15 @@ class EstablishmentDocument(Document):
|
|||
'value': fields.KeywordField(),
|
||||
},
|
||||
multi=True, attr='artisan_category_indexing')
|
||||
visible_tags = fields.ObjectField(
|
||||
distillery_type = fields.ObjectField(
|
||||
properties={
|
||||
'id': fields.IntegerField(attr='id'),
|
||||
'label': fields.ObjectField(attr='label_indexing',
|
||||
properties=OBJECT_FIELD_PROPERTIES),
|
||||
'value': fields.KeywordField(),
|
||||
},
|
||||
multi=True)
|
||||
distillery_types = fields.ObjectField(
|
||||
multi=True, attr='distillery_type_indexing')
|
||||
visible_tags = fields.ObjectField(
|
||||
properties={
|
||||
'id': fields.IntegerField(attr='id'),
|
||||
'label': fields.ObjectField(attr='label_indexing',
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ class EstablishmentDocumentSerializer(InFavoritesMixin, DocumentSerializer):
|
|||
tags = TagsDocumentSerializer(many=True, source='visible_tags')
|
||||
restaurant_category = 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)
|
||||
schedule = ScheduleDocumentSerializer(many=True, allow_null=True)
|
||||
wine_origins = WineOriginSerializer(many=True)
|
||||
|
|
@ -311,7 +311,7 @@ class EstablishmentDocumentSerializer(InFavoritesMixin, DocumentSerializer):
|
|||
# 'collections',
|
||||
'type',
|
||||
'subtypes',
|
||||
'distillery_types',
|
||||
'distillery_type',
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user