BO title field

This commit is contained in:
Kuroshini 2019-12-10 15:39:53 +03:00
parent bec4e9be96
commit 3b85e927a1
4 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.7 on 2019-12-10 12:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0037_auto_20191129_1320'),
]
operations = [
migrations.AddField(
model_name='news',
name='backoffice_title',
field=models.TextField(default=None, null=True, verbose_name='Title for searching via BO'),
),
]

View File

@ -168,6 +168,8 @@ class News(GalleryModelMixin, BaseAttributes, TranslatedFieldsMixin, HasTagsMixi
title = TJSONField(blank=True, null=True, default=None, title = TJSONField(blank=True, null=True, default=None,
verbose_name=_('title'), verbose_name=_('title'),
help_text='{"en-GB":"some text"}') help_text='{"en-GB":"some text"}')
backoffice_title = models.TextField(null=True, default=None,
verbose_name=_('Title for searching via BO'))
subtitle = TJSONField(blank=True, null=True, default=None, subtitle = TJSONField(blank=True, null=True, default=None,
verbose_name=_('subtitle'), verbose_name=_('subtitle'),
help_text='{"en-GB":"some text"}') help_text='{"en-GB":"some text"}')

View File

@ -169,9 +169,13 @@ class NewsBackOfficeBaseSerializer(NewsBaseSerializer):
fields = NewsBaseSerializer.Meta.fields + ( fields = NewsBaseSerializer.Meta.fields + (
'title', 'title',
'backoffice_title',
'subtitle', 'subtitle',
'is_published', 'is_published',
) )
extra_kwargs = {
'backoffice_title': {'allow_null': False},
}
class NewsBackOfficeDetailSerializer(NewsBackOfficeBaseSerializer, class NewsBackOfficeDetailSerializer(NewsBackOfficeBaseSerializer,

View File

@ -17,6 +17,7 @@ class NewsDocument(Document):
'name': fields.KeywordField()}) 'name': fields.KeywordField()})
title = fields.ObjectField(attr='title_indexing', title = fields.ObjectField(attr='title_indexing',
properties=OBJECT_FIELD_PROPERTIES) properties=OBJECT_FIELD_PROPERTIES)
backoffice_title = fields.KeywordField(analyzer='english')
subtitle = fields.ObjectField(attr='subtitle_indexing', subtitle = fields.ObjectField(attr='subtitle_indexing',
properties=OBJECT_FIELD_PROPERTIES) properties=OBJECT_FIELD_PROPERTIES)
description = fields.ObjectField(attr='description_indexing', description = fields.ObjectField(attr='description_indexing',