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