diff --git a/cof/settings/common.py b/cof/settings/common.py index ffcb8ee5..0117c662 100644 --- a/cof/settings/common.py +++ b/cof/settings/common.py @@ -73,7 +73,9 @@ INSTALLED_APPS = [ 'wagtailmenus', 'modelcluster', 'taggit', + 'wagtail_modeltranslation', 'kfet.cms', + 'gestioncof.cms', ] MIDDLEWARE_CLASSES = [ @@ -89,6 +91,7 @@ MIDDLEWARE_CLASSES = [ 'djconfig.middleware.DjConfigMiddleware', 'wagtail.wagtailcore.middleware.SiteMiddleware', 'wagtail.wagtailredirects.middleware.RedirectMiddleware', + 'django.middleware.locale.LocaleMiddleware', ] ROOT_URLCONF = 'cof.urls' @@ -141,6 +144,11 @@ USE_L10N = True USE_TZ = True +LANGUAGES = ( + ('fr', u'Français'), + ('en', u'English'), +) + # Various additional settings SITE_ID = 1 diff --git a/gestioncof/cms/__init__.py b/gestioncof/cms/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/gestioncof/cms/admin.py b/gestioncof/cms/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/gestioncof/cms/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/gestioncof/cms/migrations/0001_initial.py b/gestioncof/cms/migrations/0001_initial.py new file mode 100644 index 00000000..5b48c5ec --- /dev/null +++ b/gestioncof/cms/migrations/0001_initial.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import wagtail.wagtailcore.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0033_remove_golive_expiry_help_text'), + ] + + operations = [ + migrations.CreateModel( + name='COFPage', + fields=[ + ('page_ptr', models.OneToOneField(primary_key=True, to='wagtailcore.Page', parent_link=True, auto_created=True, serialize=False)), + ('title_fr', models.CharField(help_text="The page title as you'd like it to be seen by the public", null=True, max_length=255, verbose_name='title')), + ('title_en', models.CharField(help_text="The page title as you'd like it to be seen by the public", null=True, max_length=255, verbose_name='title')), + ('slug_fr', models.SlugField(help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', null=True, max_length=255, verbose_name='slug')), + ('slug_en', models.SlugField(help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', null=True, max_length=255, verbose_name='slug')), + ('url_path_fr', models.TextField(blank=True, null=True, editable=False, verbose_name='URL path')), + ('url_path_en', models.TextField(blank=True, null=True, editable=False, verbose_name='URL path')), + ('seo_title_fr', models.CharField(help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", null=True, blank=True, max_length=255, verbose_name='page title')), + ('seo_title_en', models.CharField(help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", null=True, blank=True, max_length=255, verbose_name='page title')), + ('search_description_fr', models.TextField(blank=True, null=True, verbose_name='search description')), + ('search_description_en', models.TextField(blank=True, null=True, verbose_name='search description')), + ('corps', wagtail.wagtailcore.fields.RichTextField()), + ('corps_fr', wagtail.wagtailcore.fields.RichTextField(null=True)), + ('corps_en', wagtail.wagtailcore.fields.RichTextField(null=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + ] diff --git a/gestioncof/cms/migrations/__init__.py b/gestioncof/cms/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/gestioncof/cms/models.py b/gestioncof/cms/models.py new file mode 100644 index 00000000..17492f08 --- /dev/null +++ b/gestioncof/cms/models.py @@ -0,0 +1,11 @@ +from django.db import models + +# Create your models here. +from wagtail.wagtailcore.models import Page, Orderable + +from wagtail.wagtailcore.fields import RichTextField, StreamField +from wagtail.wagtailcore import blocks + + +class COFPage(Page): + corps = RichTextField() diff --git a/gestioncof/cms/tests.py b/gestioncof/cms/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/gestioncof/cms/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/gestioncof/cms/translation.py b/gestioncof/cms/translation.py new file mode 100644 index 00000000..b705f6ed --- /dev/null +++ b/gestioncof/cms/translation.py @@ -0,0 +1,11 @@ +from .models import COFPage + +from wagtail_modeltranslation.translator import WagtailTranslationOptions +from modeltranslation.decorators import register + +@register(COFPage) +class COFPageTr(WagtailTranslationOptions): + fields = ( + 'corps', + ) + diff --git a/gestioncof/cms/urls.py b/gestioncof/cms/urls.py new file mode 100644 index 00000000..e69de29b diff --git a/gestioncof/cms/views.py b/gestioncof/cms/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/gestioncof/cms/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/requirements.txt b/requirements.txt index 1da8c361..91b13db4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,3 +25,4 @@ channels==1.1.5 python-dateutil wagtail==1.10.* wagtailmenus==2.2.* +wagtail-modeltranslation==0.6.0rc2