Artisan category tags for establishments
This commit is contained in:
parent
e981b48fa0
commit
e40156908b
|
|
@ -610,6 +610,10 @@ class Establishment(GalleryModelMixin, ProjectBaseMixin, URLImageMixin,
|
|||
def restaurant_cuisine_indexing(self):
|
||||
return self.tags.filter(category__index_name='cuisine')
|
||||
|
||||
@property
|
||||
def artisan_category_indexing(self):
|
||||
return self.tags.filter(category__index_name='shop_category')
|
||||
|
||||
|
||||
class EstablishmentNoteQuerySet(models.QuerySet):
|
||||
"""QuerySet for model EstablishmentNote."""
|
||||
|
|
|
|||
|
|
@ -322,6 +322,7 @@ class EstablishmentListRetrieveSerializer(EstablishmentBaseSerializer):
|
|||
schedule = ScheduleRUDSerializer(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)
|
||||
artisan_category = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||
|
||||
class Meta(EstablishmentBaseSerializer.Meta):
|
||||
"""Meta class."""
|
||||
|
|
@ -330,6 +331,7 @@ class EstablishmentListRetrieveSerializer(EstablishmentBaseSerializer):
|
|||
'schedule',
|
||||
'restaurant_category',
|
||||
'restaurant_cuisine',
|
||||
'artisan_category',
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ 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_ceratin_tag_category_related('shop_category', 'artisan_category')
|
||||
|
||||
|
||||
class EstablishmentRetrieveView(EstablishmentMixinView, generics.RetrieveAPIView):
|
||||
|
|
|
|||
|
|
@ -65,6 +65,14 @@ class EstablishmentDocument(Document):
|
|||
'value': fields.KeywordField(),
|
||||
},
|
||||
multi=True, attr='restaurant_cuisine_indexing')
|
||||
artisan_category = fields.ObjectField(
|
||||
properties={
|
||||
'id': fields.IntegerField(attr='id'),
|
||||
'label': fields.ObjectField(attr='label_indexing',
|
||||
properties=OBJECT_FIELD_PROPERTIES),
|
||||
'value': fields.KeywordField(),
|
||||
},
|
||||
multi=True, attr='artisan_category_indexing')
|
||||
visible_tags = fields.ObjectField(
|
||||
properties={
|
||||
'id': fields.IntegerField(attr='id'),
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ class EstablishmentDocumentSerializer(InFavoritesMixin, DocumentSerializer):
|
|||
tags = TagsDocumentSerializer(many=True, source='visible_tags')
|
||||
restaurant_category = TagsDocumentSerializer(many=True)
|
||||
restaurant_cuisine = TagsDocumentSerializer(many=True)
|
||||
artisan_category = TagsDocumentSerializer(many=True)
|
||||
schedule = ScheduleDocumentSerializer(many=True, allow_null=True)
|
||||
|
||||
class Meta:
|
||||
|
|
@ -251,6 +252,7 @@ class EstablishmentDocumentSerializer(InFavoritesMixin, DocumentSerializer):
|
|||
'tags',
|
||||
'restaurant_category',
|
||||
'restaurant_cuisine',
|
||||
'artisan_category',
|
||||
'schedule',
|
||||
'works_noon',
|
||||
'works_evening',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user