From e02256acc34cc11c34ab7ffd15704ab680e97a68 Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Wed, 16 May 2018 15:16:20 +0200 Subject: [PATCH] Language support, requirements fix --- .../migrations/0022_auto_20180516_1515.py | 43 +++++++++++++++++++ publichealth/home/models/models.py | 2 + publichealth/home/util.py | 2 +- requirements.txt | 3 +- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 publichealth/home/migrations/0022_auto_20180516_1515.py diff --git a/publichealth/home/migrations/0022_auto_20180516_1515.py b/publichealth/home/migrations/0022_auto_20180516_1515.py new file mode 100644 index 0000000..618593a --- /dev/null +++ b/publichealth/home/migrations/0022_auto_20180516_1515.py @@ -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), + ), + ] diff --git a/publichealth/home/models/models.py b/publichealth/home/models/models.py index 4266ffa..a3bd587 100644 --- a/publichealth/home/models/models.py +++ b/publichealth/home/models/models.py @@ -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) diff --git a/publichealth/home/util.py b/publichealth/home/util.py index 4b03c5d..f917f50 100644 --- a/publichealth/home/util.py +++ b/publichealth/home/util.py @@ -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 diff --git a/requirements.txt b/requirements.txt index 8b2c236..ef9a472 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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