News multilang slug (ES)

This commit is contained in:
Kuroshini 2019-12-10 19:23:40 +03:00
parent 4010c9fede
commit c1bb7c9b79
6 changed files with 21 additions and 6 deletions

View File

@ -0,0 +1,17 @@
# Generated by Django 2.2.7 on 2019-12-10 16:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('news', '0039_news_slugs'),
]
operations = [
migrations.RemoveField(
model_name='news',
name='slug',
),
]

View File

@ -181,8 +181,6 @@ class News(GalleryModelMixin, BaseAttributes, TranslatedFieldsMixin, HasTagsMixi
verbose_name=_('Start'))
end = models.DateTimeField(blank=True, null=True, default=None,
verbose_name=_('End'))
slug = models.SlugField(unique=True, max_length=255,
verbose_name=_('News slug'))
slugs = HStoreField(null=True, blank=True, default=None,
verbose_name=_('Slugs for current news obj'),
help_text='{"en-GB":"some slug"}')

View File

@ -80,7 +80,7 @@ class NewsBaseSerializer(ProjectModelSerializer):
'is_highlighted',
'news_type',
'tags',
'slug',
'slugs',
'view_counter',
)

View File

@ -7,7 +7,7 @@ from establishment import models
EstablishmentIndex = Index(settings.ELASTICSEARCH_INDEX_NAMES.get(__name__,
'establishment'))
EstablishmentIndex.settings(number_of_shards=1, number_of_replicas=1)
EstablishmentIndex.settings(number_of_shards=5, number_of_replicas=2)
@EstablishmentIndex.doc_type

View File

@ -17,6 +17,7 @@ class NewsDocument(Document):
'name': fields.KeywordField()})
title = fields.ObjectField(attr='title_indexing',
properties=OBJECT_FIELD_PROPERTIES)
slugs = fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES)
backoffice_title = fields.TextField(analyzer='english')
subtitle = fields.ObjectField(attr='subtitle_indexing',
properties=OBJECT_FIELD_PROPERTIES)
@ -50,7 +51,6 @@ class NewsDocument(Document):
fields = (
'id',
'end',
'slug',
'state',
'is_highlighted',
'template',

View File

@ -221,7 +221,7 @@ class NewsDocumentSerializer(InFavoritesMixin, DocumentSerializer):
'news_type',
'tags',
'start',
'slug',
'slugs',
)
@staticmethod