Un seul modèle pour les actus

This commit is contained in:
Evarin 2018-01-22 21:24:20 +01:00
parent 8551ffcfd3
commit 8488beeb4e
10 changed files with 120 additions and 183 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,197 +1,175 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-20 19:10
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
import wagtail.wagtailcore.fields import django.db.models.deletion
import wagtail.wagtailimages.blocks
import gestioncof.cms.models import gestioncof.cms.models
import wagtail.wagtailcore.blocks import wagtail.wagtailcore.blocks
import django.db.models.deletion import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration): class Migration(migrations.Migration):
initial = True
dependencies = [ dependencies = [
('wagtailcore', '0033_remove_golive_expiry_help_text'), ('wagtailcore', '0033_remove_golive_expiry_help_text'),
('wagtailimages', '0019_delete_filter'), ('wagtailimages', '0019_delete_filter'),
] ]
operations = [ operations = [
migrations.CreateModel(
name='COFActuEventPage',
fields=[
('page_ptr', models.OneToOneField(serialize=False, parent_link=True, to='wagtailcore.Page', primary_key=True, auto_created=True)),
('title_fr', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)),
('title_en', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)),
('slug_fr', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)),
('slug_en', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)),
('url_path_fr', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')),
('url_path_en', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')),
('seo_title_fr', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)),
('seo_title_en', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)),
('search_description_fr', models.TextField(null=True, blank=True, verbose_name='search description')),
('search_description_en', models.TextField(null=True, blank=True, verbose_name='search description')),
('chapo', models.TextField(verbose_name='Description rapide')),
('chapo_fr', models.TextField(null=True, verbose_name='Description rapide')),
('chapo_en', models.TextField(null=True, verbose_name='Description rapide')),
('body', wagtail.wagtailcore.fields.RichTextField(verbose_name='Description longue')),
('body_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Description longue')),
('body_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Description longue')),
('date_start', models.DateTimeField(verbose_name='Date et heure de début')),
('date_end', models.DateTimeField(null=True, blank=True, default=None, verbose_name='Date et heure de fin')),
('all_day', models.BooleanField(default=False, verbose_name='Toute la journée')),
('image', models.ForeignKey(null=True, blank=True, on_delete=django.db.models.deletion.SET_NULL, to='wagtailimages.Image', related_name='+', verbose_name='Image à la Une')),
],
options={
'verbose_name_plural': 'Actus liées à des évènements',
'verbose_name': 'Actu liée à un évènement',
},
bases=('wagtailcore.page',),
),
migrations.CreateModel( migrations.CreateModel(
name='COFActuIndexPage', name='COFActuIndexPage',
fields=[ fields=[
('page_ptr', models.OneToOneField(serialize=False, parent_link=True, to='wagtailcore.Page', primary_key=True, auto_created=True)), ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('title_fr', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_fr', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('title_en', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_en', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('slug_fr', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_fr', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('slug_en', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_en', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('url_path_fr', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_fr', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('url_path_en', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_en', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('seo_title_fr', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_fr', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('seo_title_en', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_en', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('search_description_fr', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_fr', models.TextField(blank=True, null=True, verbose_name='search description')),
('search_description_en', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_en', models.TextField(blank=True, null=True, verbose_name='search description')),
], ],
options={ options={
'verbose_name_plural': 'Indexs des actualités',
'verbose_name': 'Index des actualités', 'verbose_name': 'Index des actualités',
'verbose_name_plural': 'Indexs des actualités',
}, },
bases=('wagtailcore.page', gestioncof.cms.models.COFActuIndexMixin), bases=('wagtailcore.page', gestioncof.cms.models.COFActuIndexMixin),
), ),
migrations.CreateModel( migrations.CreateModel(
name='COFActuPage', name='COFActuPage',
fields=[ fields=[
('page_ptr', models.OneToOneField(serialize=False, parent_link=True, to='wagtailcore.Page', primary_key=True, auto_created=True)), ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('title_fr', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_fr', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('title_en', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_en', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('slug_fr', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_fr', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('slug_en', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_en', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('url_path_fr', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_fr', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('url_path_en', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_en', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('seo_title_fr', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_fr', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('seo_title_en', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_en', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('search_description_fr', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_fr', models.TextField(blank=True, null=True, verbose_name='search description')),
('search_description_en', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_en', models.TextField(blank=True, null=True, verbose_name='search description')),
('chapo', models.TextField(blank=True, verbose_name='Description rapide')),
('chapo_fr', models.TextField(blank=True, null=True, verbose_name='Description rapide')),
('chapo_en', models.TextField(blank=True, null=True, verbose_name='Description rapide')),
('body', wagtail.wagtailcore.fields.RichTextField(verbose_name='Contenu')), ('body', wagtail.wagtailcore.fields.RichTextField(verbose_name='Contenu')),
('body_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Contenu')), ('body_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Contenu')),
('body_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Contenu')), ('body_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Contenu')),
('date', models.DateField(verbose_name='Date du post')), ('is_event', models.BooleanField(default=True, verbose_name='Évènement')),
('image', models.ForeignKey(null=True, blank=True, on_delete=django.db.models.deletion.SET_NULL, to='wagtailimages.Image', related_name='+', verbose_name='Image à la Une')), ('date_start', models.DateTimeField(verbose_name='Date et heure de début')),
('date_end', models.DateTimeField(blank=True, default=None, null=True, verbose_name='Date et heure de fin')),
('all_day', models.BooleanField(default=False, verbose_name='Toute la journée')),
('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image', verbose_name='Image à la Une')),
], ],
options={ options={
'verbose_name_plural': 'Actualités simples', 'verbose_name': 'Actualité',
'verbose_name': 'Actualité simple', 'verbose_name_plural': 'Actualités',
}, },
bases=('wagtailcore.page',), bases=('wagtailcore.page',),
), ),
migrations.CreateModel( migrations.CreateModel(
name='COFDirectoryEntryPage', name='COFDirectoryEntryPage',
fields=[ fields=[
('page_ptr', models.OneToOneField(serialize=False, parent_link=True, to='wagtailcore.Page', primary_key=True, auto_created=True)), ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('title_fr', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_fr', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('title_en', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_en', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('slug_fr', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_fr', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('slug_en', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_en', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('url_path_fr', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_fr', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('url_path_en', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_en', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('seo_title_fr', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_fr', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('seo_title_en', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_en', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('search_description_fr', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_fr', models.TextField(blank=True, null=True, verbose_name='search description')),
('search_description_en', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_en', models.TextField(blank=True, null=True, verbose_name='search description')),
('body', wagtail.wagtailcore.fields.RichTextField(verbose_name='Description')), ('body', wagtail.wagtailcore.fields.RichTextField(verbose_name='Description')),
('body_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Description')), ('body_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Description')),
('body_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Description')), ('body_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Description')),
('links', wagtail.wagtailcore.fields.StreamField((('lien', wagtail.wagtailcore.blocks.StructBlock((('url', wagtail.wagtailcore.blocks.URLBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock())))), ('contact', wagtail.wagtailcore.blocks.StructBlock((('email', wagtail.wagtailcore.blocks.EmailBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock()))))))), ('links', wagtail.wagtailcore.fields.StreamField((('lien', wagtail.wagtailcore.blocks.StructBlock((('url', wagtail.wagtailcore.blocks.URLBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock())))), ('contact', wagtail.wagtailcore.blocks.StructBlock((('email', wagtail.wagtailcore.blocks.EmailBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock()))))))),
('links_fr', wagtail.wagtailcore.fields.StreamField((('lien', wagtail.wagtailcore.blocks.StructBlock((('url', wagtail.wagtailcore.blocks.URLBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock())))), ('contact', wagtail.wagtailcore.blocks.StructBlock((('email', wagtail.wagtailcore.blocks.EmailBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock()))))), null=True)), ('links_fr', wagtail.wagtailcore.fields.StreamField((('lien', wagtail.wagtailcore.blocks.StructBlock((('url', wagtail.wagtailcore.blocks.URLBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock())))), ('contact', wagtail.wagtailcore.blocks.StructBlock((('email', wagtail.wagtailcore.blocks.EmailBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock()))))), null=True)),
('links_en', wagtail.wagtailcore.fields.StreamField((('lien', wagtail.wagtailcore.blocks.StructBlock((('url', wagtail.wagtailcore.blocks.URLBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock())))), ('contact', wagtail.wagtailcore.blocks.StructBlock((('email', wagtail.wagtailcore.blocks.EmailBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock()))))), null=True)), ('links_en', wagtail.wagtailcore.fields.StreamField((('lien', wagtail.wagtailcore.blocks.StructBlock((('url', wagtail.wagtailcore.blocks.URLBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock())))), ('contact', wagtail.wagtailcore.blocks.StructBlock((('email', wagtail.wagtailcore.blocks.EmailBlock(required=True)), ('texte', wagtail.wagtailcore.blocks.CharBlock()))))), null=True)),
('image', models.ForeignKey(null=True, blank=True, on_delete=django.db.models.deletion.SET_NULL, to='wagtailimages.Image', related_name='+', verbose_name='Image')), ('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image', verbose_name='Image')),
], ],
options={ options={
'verbose_name_plural': "Éntrées d'annuaire",
'verbose_name': "Éntrée d'annuaire", 'verbose_name': "Éntrée d'annuaire",
'verbose_name_plural': "Éntrées d'annuaire",
}, },
bases=('wagtailcore.page',), bases=('wagtailcore.page',),
), ),
migrations.CreateModel( migrations.CreateModel(
name='COFDirectoryPage', name='COFDirectoryPage',
fields=[ fields=[
('page_ptr', models.OneToOneField(serialize=False, parent_link=True, to='wagtailcore.Page', primary_key=True, auto_created=True)), ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('title_fr', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_fr', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('title_en', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_en', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('slug_fr', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_fr', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('slug_en', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_en', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('url_path_fr', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_fr', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('url_path_en', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_en', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('seo_title_fr', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_fr', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('seo_title_en', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_en', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('search_description_fr', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_fr', models.TextField(blank=True, null=True, verbose_name='search description')),
('search_description_en', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_en', models.TextField(blank=True, null=True, verbose_name='search description')),
('introduction', wagtail.wagtailcore.fields.RichTextField(verbose_name='Introduction')), ('introduction', wagtail.wagtailcore.fields.RichTextField(verbose_name='Introduction')),
('introduction_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')), ('introduction_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')),
('introduction_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')), ('introduction_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')),
], ],
options={ options={
'verbose_name_plural': 'Annuaires',
'verbose_name': 'Annuaire (clubs, partenaires, bons plans...)', 'verbose_name': 'Annuaire (clubs, partenaires, bons plans...)',
'verbose_name_plural': 'Annuaires',
}, },
bases=('wagtailcore.page',), bases=('wagtailcore.page',),
), ),
migrations.CreateModel( migrations.CreateModel(
name='COFPage', name='COFPage',
fields=[ fields=[
('page_ptr', models.OneToOneField(serialize=False, parent_link=True, to='wagtailcore.Page', primary_key=True, auto_created=True)), ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('title_fr', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_fr', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('title_en', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_en', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('slug_fr', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_fr', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('slug_en', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_en', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('url_path_fr', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_fr', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('url_path_en', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_en', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('seo_title_fr', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_fr', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('seo_title_en', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_en', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('search_description_fr', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_fr', models.TextField(blank=True, null=True, verbose_name='search description')),
('search_description_en', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_en', models.TextField(blank=True, null=True, verbose_name='search description')),
('body', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock())))), ('body', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock())))),
('body_fr', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock())), null=True)), ('body_fr', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock())), null=True)),
('body_en', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock())), null=True)), ('body_en', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock())), null=True)),
], ],
options={ options={
'verbose_name_plural': 'Pages normales COF',
'verbose_name': 'Page normale COF', 'verbose_name': 'Page normale COF',
'verbose_name_plural': 'Pages normales COF',
}, },
bases=('wagtailcore.page',), bases=('wagtailcore.page',),
), ),
migrations.CreateModel( migrations.CreateModel(
name='COFRootPage', name='COFRootPage',
fields=[ fields=[
('page_ptr', models.OneToOneField(serialize=False, parent_link=True, to='wagtailcore.Page', primary_key=True, auto_created=True)), ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('title_fr', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_fr', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('title_en', models.CharField(null=True, verbose_name='title', help_text="The page title as you'd like it to be seen by the public", max_length=255)), ('title_en', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, null=True, verbose_name='title')),
('slug_fr', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_fr', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('slug_en', models.SlugField(null=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', verbose_name='slug', max_length=255)), ('slug_en', models.SlugField(allow_unicode=True, help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255, null=True, verbose_name='slug')),
('url_path_fr', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_fr', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('url_path_en', models.TextField(null=True, blank=True, editable=False, verbose_name='URL path')), ('url_path_en', models.TextField(blank=True, editable=False, null=True, verbose_name='URL path')),
('seo_title_fr', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_fr', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('seo_title_en', models.CharField(null=True, blank=True, verbose_name='page title', help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255)), ('seo_title_en', models.CharField(blank=True, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", max_length=255, null=True, verbose_name='page title')),
('search_description_fr', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_fr', models.TextField(blank=True, null=True, verbose_name='search description')),
('search_description_en', models.TextField(null=True, blank=True, verbose_name='search description')), ('search_description_en', models.TextField(blank=True, null=True, verbose_name='search description')),
('introduction', wagtail.wagtailcore.fields.RichTextField(verbose_name='Introduction')), ('introduction', wagtail.wagtailcore.fields.RichTextField(verbose_name='Introduction')),
('introduction_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')), ('introduction_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')),
('introduction_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')), ('introduction_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')),
], ],
options={ options={
'verbose_name_plural': 'Racines site du COF',
'verbose_name': 'Racine site du COF', 'verbose_name': 'Racine site du COF',
'verbose_name_plural': 'Racines site du COF',
}, },
bases=('wagtailcore.page', gestioncof.cms.models.COFActuIndexMixin), bases=('wagtailcore.page', gestioncof.cms.models.COFActuIndexMixin),
), ),

View file

@ -2,6 +2,7 @@ from django.db import models
from wagtail.wagtailcore.models import Page, Orderable from wagtail.wagtailcore.models import Page, Orderable
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from wagtail.wagtailcore.fields import RichTextField, StreamField from wagtail.wagtailcore.fields import RichTextField, StreamField
from wagtail.wagtailcore import blocks from wagtail.wagtailcore import blocks
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
@ -15,10 +16,8 @@ from wagtail.wagtailsnippets.models import register_snippet
class COFActuIndexMixin(): class COFActuIndexMixin():
@property @property
def actus(self): def actus(self):
actus = COFActuPage.objects.live().descendant_of(self) actus = COFActuPage.objects.live().order_by('-date_start').descendant_of(self)
events = COFActuEventPage.objects.live().descendant_of(self) return actus
genactus = list(actus) + list(events)
return genactus
# Racine du site du COF # Racine du site du COF
class COFRootPage(Page, COFActuIndexMixin): class COFRootPage(Page, COFActuIndexMixin):
@ -55,7 +54,7 @@ class COFPage(Page):
# Actualités # Actualités
class COFActuIndexPage(Page, COFActuIndexMixin): class COFActuIndexPage(Page, COFActuIndexMixin):
subpage_types = ['COFActuPage', 'COFActuEventPage'] subpage_types = ['COFActuPage']
parent_page_types = ['COFRootPage'] parent_page_types = ['COFRootPage']
class Meta: class Meta:
@ -64,7 +63,7 @@ class COFActuIndexPage(Page, COFActuIndexMixin):
def get_context(self, request): def get_context(self, request):
context = super(COFActuIndexPage, self).get_context(request) context = super(COFActuIndexPage, self).get_context(request)
actus = COFActuPage.objects.live().descendant_of(self).order_by('-date') actus = COFActuPage.objects.live().descendant_of(self).order_by('-date_end')
page = request.GET.get('page') page = request.GET.get('page')
paginator = Paginator(actus, 5) paginator = Paginator(actus, 5)
@ -79,18 +78,27 @@ class COFActuIndexPage(Page, COFActuIndexMixin):
return context return context
class COFActuPage(Page): class COFActuPage(Page):
chapo = models.TextField("Description rapide", blank=True)
body = RichTextField("Contenu") body = RichTextField("Contenu")
date = models.DateField("Date du post")
image = models.ForeignKey( image = models.ForeignKey(
'wagtailimages.Image', verbose_name="Image à la Une", 'wagtailimages.Image', verbose_name="Image à la Une",
null=True, blank=True, null=True, blank=True,
on_delete=models.SET_NULL, related_name='+' on_delete=models.SET_NULL, related_name='+'
) )
is_event = models.BooleanField("Évènement", default=True, blank=True)
date_start = models.DateTimeField("Date et heure de début")
date_end = models.DateTimeField("Date et heure de fin", blank=True, default=None, null=True)
all_day = models.BooleanField("Toute la journée", default=False, blank=True)
content_panels = Page.content_panels + [ content_panels = Page.content_panels + [
FieldPanel('date'),
ImageChooserPanel('image'), ImageChooserPanel('image'),
FieldPanel('chapo'),
FieldPanel('body', classname="full"), FieldPanel('body', classname="full"),
FieldPanel("is_event"),
FieldPanel("date_start"),
FieldPanel("date_end"),
FieldPanel("all_day"),
] ]
subpage_types = [] subpage_types = []
@ -100,33 +108,6 @@ class COFActuPage(Page):
verbose_name = "Actualité simple" verbose_name = "Actualité simple"
verbose_name_plural = "Actualités simples" verbose_name_plural = "Actualités simples"
# Évènements
class COFActuEventPage(Page):
chapo = models.TextField("Description rapide")
body = RichTextField("Description longue")
image = models.ForeignKey(
'wagtailimages.Image', verbose_name="Image à la Une",
null=True, blank=True,
on_delete=models.SET_NULL, related_name='+'
)
date_start = models.DateTimeField("Date et heure de début")
date_end = models.DateTimeField("Date et heure de fin", blank=True, default=None, null=True)
all_day = models.BooleanField("Toute la journée", default=False, blank=True)
is_event = True
content_panels = Page.content_panels + [
ImageChooserPanel('image'),
FieldPanel('chapo'),
FieldPanel('body', classname="full"),
FieldPanel("date_start"),
FieldPanel("date_end"),
FieldPanel("all_day"),
]
subpage_types = []
parent_page_types = ['COFActuIndexPage']
@property @property
def dates(self): def dates(self):
if self.date_end: if self.date_end:
@ -147,8 +128,8 @@ class COFActuEventPage(Page):
diff_i = len(tmpl) - 3 diff_i = len(tmpl) - 3
elif self.date_end.day != self.date_start.day: elif self.date_end.day != self.date_start.day:
diff_i = len(tmpl) - 6 diff_i = len(tmpl) - 6
common = tmpl[diff_i:] common = tmpl[diff_i:]
diff = tmpl[:diff_i] diff = tmpl[:diff_i]
if self.all_day: if self.all_day:
return _("du %s au %s %s") % \ return _("du %s au %s %s") % \
(self.date_start.strftime(diff), (self.date_start.strftime(diff),
@ -167,8 +148,8 @@ class COFActuEventPage(Page):
else: else:
return self.date_start.strftime(_("le %A %d %B %Y à %Hh%M")) return self.date_start.strftime(_("le %A %d %B %Y à %Hh%M"))
class Meta: class Meta:
verbose_name = "Actu liée à un évènement" verbose_name = "Actualité"
verbose_name_plural = "Actus liées à des évènements" verbose_name_plural = "Actualités"
# Annuaires (Clubs, partenaires, bonnes adresses) # Annuaires (Clubs, partenaires, bonnes adresses)
class COFDirectoryPage(Page): class COFDirectoryPage(Page):

View file

@ -1,17 +0,0 @@
{% extends "cofcms/base.html" %}
{% load wagtailimages_tags cofcms_tags %}
{% block content %}
<section class="intro">
<h1>{{ page.title }}</h1>
<p class="date">A lieu {{ page.dates }}</p>
<p>{{ page.chapo }}</p>
</section>
<section class="pagecontent">
{% image page.image width-700 %}
<article>
{{ page.body|safe }}
</article>
</section>
{% endblock %}

View file

@ -27,7 +27,7 @@
{% if actu.is_event %} {% if actu.is_event %}
<p><span class="actu-dates">{{ actu.dates|capfirst }}</span><br />{{ actu.chapo }}</p> <p><span class="actu-dates">{{ actu.dates|capfirst }}</span><br />{{ actu.chapo }}</p>
{% else %} {% else %}
{{ actu.body|safe|truncatewords_html:25 }} {{ actu.body|safe|truncatewords_html:15 }}
{% endif %} {% endif %}
<a href="{% pageurl actu %}">Lire plus &gt;</a> <a href="{% pageurl actu %}">Lire plus &gt;</a>
</div> </div>

View file

@ -4,7 +4,8 @@
{% block content %} {% block content %}
<section class="intro"> <section class="intro">
<h1>{{ page.title }}</h1> <h1>{{ page.title }}</h1>
<p class="date">Publié le {{ page.date }}</p> <p class="date">A lieu {{ page.dates }}</p>
<p>{{ page.chapo }}</p>
</section> </section>
<section class="pagecontent"> <section class="pagecontent">

View file

@ -22,7 +22,7 @@
{% get_current_language as curlang %} {% get_current_language as curlang %}
<span class="actu-minical">{% mini_calendar actu curlang %}</span><span class="actu-dates">{{ actu.dates }}</span> <span class="actu-minical">{% mini_calendar actu curlang %}</span><span class="actu-dates">{{ actu.dates }}</span>
{% else %} {% else %}
{{ actu.body|safe|truncatewords_html:25 }} {{ actu.body|safe|truncatewords_html:10 }}
{% endif %} {% endif %}
</div> </div>
<a href="{% pageurl actu %}" class="actu-overlay"></a> <a href="{% pageurl actu %}" class="actu-overlay"></a>

View file

@ -4,7 +4,7 @@ from django.conf import settings
from django.utils import timezone from django.utils import timezone
import locale import locale
from ..models import COFActuEventPage from ..models import COFActuPage
import re import re
@ -23,10 +23,10 @@ def calendar():
next_month = date(next_month.year, next_month.month, 1) next_month = date(next_month.year, next_month.month, 1)
month_prestart = month_start - timedelta(days=month_start.weekday()) month_prestart = month_start - timedelta(days=month_start.weekday())
month_postend = next_month + timedelta(days=(next_month.weekday()+6)%7) month_postend = next_month + timedelta(days=(next_month.weekday()+6)%7)
events = COFActuEventPage.objects.live()\ events = COFActuPage.objects.live()\
.filter(date_start__range=[month_prestart, .filter(date_start__range=[month_prestart,
month_postend])\ month_postend])\
.order_by('-date_start') .order_by('-date_start')
events = list(events) events = list(events)
weeks = [] weeks = []
curday = month_prestart curday = month_prestart

View file

@ -1,4 +1,4 @@
from .models import COFRootPage, COFPage, COFActuEventPage, COFActuIndexPage, COFActuPage, COFDirectoryPage, COFDirectoryEntryPage from .models import COFRootPage, COFPage, COFActuIndexPage, COFActuPage, COFDirectoryPage, COFDirectoryEntryPage
from wagtail_modeltranslation.translator import WagtailTranslationOptions from wagtail_modeltranslation.translator import WagtailTranslationOptions
from modeltranslation.decorators import register from modeltranslation.decorators import register
@ -15,13 +15,6 @@ class COFPageTr(WagtailTranslationOptions):
'body', 'body',
) )
@register(COFActuEventPage)
class COFActuEventPageTr(WagtailTranslationOptions):
fields = (
'chapo',
'body',
)
@register(COFActuIndexPage) @register(COFActuIndexPage)
class COFActuIndexPageTr(WagtailTranslationOptions): class COFActuIndexPageTr(WagtailTranslationOptions):
fields = ( fields = (
@ -30,6 +23,7 @@ class COFActuIndexPageTr(WagtailTranslationOptions):
@register(COFActuPage) @register(COFActuPage)
class COFActuPageTr(WagtailTranslationOptions): class COFActuPageTr(WagtailTranslationOptions):
fields = ( fields = (
'chapo',
'body', 'body',
) )