Language support, requirements fix

This commit is contained in:
Oleg Lavrovsky 2018-05-16 15:16:20 +02:00
parent 1e910656ee
commit e02256acc3
4 changed files with 48 additions and 2 deletions

View File

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-16 13:15
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration):
dependencies = [
('home', '0021_auto_20171013_2321'),
]
operations = [
migrations.AddField(
model_name='articleindexpage',
name='intro_en',
field=wagtail.wagtailcore.fields.RichTextField(blank=True, default=''),
),
migrations.AddField(
model_name='articleindexpage',
name='title_en',
field=models.CharField(default='', max_length=255),
),
migrations.AddField(
model_name='articlepage',
name='body_en',
field=wagtail.wagtailcore.fields.StreamField((('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('section', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('action', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('url', wagtail.wagtailcore.blocks.URLBlock(required=False))), icon='help')), ('media', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('gallery', 'Image gallery')], icon='media'))), blank=True, null=True),
),
migrations.AddField(
model_name='articlepage',
name='intro_en',
field=wagtail.wagtailcore.fields.RichTextField(blank=True, default=''),
),
migrations.AddField(
model_name='articlepage',
name='title_en',
field=models.CharField(default='', max_length=255),
),
]

View File

@ -31,9 +31,11 @@ class InfoBlock(StructBlock):
class ArticleIndexPage(Page):
title_fr = models.CharField(max_length=255, default="")
title_en = models.CharField(max_length=255, default="")
trans_title = TranslatedField(
'title',
'title_fr',
'title_en',
)
intro_de = RichTextField(default='', blank=True)

View File

@ -1,7 +1,7 @@
from django.utils import translation
class TranslatedField(object):
def __init__(self, de_field, fr_field, en_field):
def __init__(self, de_field, fr_field, en_field=None):
self.de_field = de_field
self.fr_field = fr_field
self.en_field = en_field

View File

@ -7,10 +7,11 @@ elasticsearch>=2.0.0,<3.0.0
# Database
psycopg2==2.7.4
psycopg2-binary==2.7.4
dj-database-url==0.5.0
# Content
puput==1.0.1
puput==0.9.2
guess-language-spirit==0.5.3
# Caching