added field - "distillery_types" to ES, change country field properties in TagCategory model

This commit is contained in:
Anatoly 2020-01-13 17:07:42 +03:00
parent f93337def3
commit c1186dd597
4 changed files with 31 additions and 2 deletions

View File

@ -85,6 +85,14 @@ class EstablishmentDocument(Document):
'value': fields.KeywordField(),
},
multi=True)
distillery_types = fields.ObjectField(
properties={
'id': fields.IntegerField(attr='id'),
'label': fields.ObjectField(attr='label_indexing',
properties=OBJECT_FIELD_PROPERTIES),
'value': fields.KeywordField(),
},
multi=True)
products = fields.ObjectField(
properties={
'wine_origins': fields.ListField(

View File

@ -277,6 +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)
artisan_category = TagsDocumentSerializer(many=True, allow_null=True)
schedule = ScheduleDocumentSerializer(many=True, allow_null=True)
wine_origins = WineOriginSerializer(many=True)
@ -310,6 +311,7 @@ class EstablishmentDocumentSerializer(InFavoritesMixin, DocumentSerializer):
# 'collections',
'type',
'subtypes',
'distillery_types',
)

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2.7 on 2020-01-13 13:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tag', '0017_auto_20191220_1623'),
]
operations = [
migrations.AlterField(
model_name='tagcategory',
name='country',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='location.Country'),
),
]

View File

@ -145,8 +145,8 @@ class TagCategory(models.Model):
(BOOLEAN, _('boolean')),
)
country = models.ForeignKey('location.Country',
on_delete=models.SET_NULL, null=True,
default=None)
on_delete=models.SET_NULL,
blank=True, null=True, default=None)
public = models.BooleanField(default=False)
index_name = models.CharField(max_length=255, blank=True, null=True,
verbose_name=_('indexing name'), unique=True)