diff --git a/gestioncof/cms/migrations/0001_initial.py b/gestioncof/cms/migrations/0001_initial.py
index 19cf61c7..e9abe2fb 100644
--- a/gestioncof/cms/migrations/0001_initial.py
+++ b/gestioncof/cms/migrations/0001_initial.py
@@ -2,50 +2,83 @@
from __future__ import unicode_literals
from django.db import migrations, models
-import django.db.models.deletion
-import wagtail.wagtailimages.blocks
-import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
+import wagtail.wagtailimages.blocks
+import gestioncof.cms.models
+import wagtail.wagtailcore.blocks
+import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
- ('wagtailimages', '0019_delete_filter'),
('wagtailcore', '0033_remove_golive_expiry_help_text'),
+ ('wagtailimages', '0019_delete_filter'),
]
operations = [
migrations.CreateModel(
- name='COFActuIndexPage',
+ name='COFActuEventPage',
fields=[
- ('page_ptr', models.OneToOneField(primary_key=True, parent_link=True, serialize=False, auto_created=True, to='wagtailcore.Page')),
+ ('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, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('slug_en', models.SlugField(null=True, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('url_path_fr', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
- ('url_path_en', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
+ ('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(
+ name='COFActuIndexPage',
+ 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')),
],
options={
- 'abstract': False,
+ 'verbose_name_plural': 'Indexs des actualités',
+ 'verbose_name': 'Index des actualités',
},
- bases=('wagtailcore.page',),
+ bases=('wagtailcore.page', gestioncof.cms.models.COFActuIndexMixin),
),
migrations.CreateModel(
name='COFActuPage',
fields=[
- ('page_ptr', models.OneToOneField(primary_key=True, parent_link=True, serialize=False, auto_created=True, to='wagtailcore.Page')),
+ ('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, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('slug_en', models.SlugField(null=True, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('url_path_fr', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
- ('url_path_en', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
+ ('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')),
@@ -54,23 +87,24 @@ class Migration(migrations.Migration):
('body_fr', 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')),
- ('Image à la Une', models.ForeignKey(null=True, to='wagtailimages.Image', on_delete=django.db.models.deletion.SET_NULL, blank=True, related_name='+')),
+ ('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={
- 'abstract': False,
+ 'verbose_name_plural': 'Actualités simples',
+ 'verbose_name': 'Actualité simple',
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='COFDirectoryEntryPage',
fields=[
- ('page_ptr', models.OneToOneField(primary_key=True, parent_link=True, serialize=False, auto_created=True, to='wagtailcore.Page')),
+ ('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, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('slug_en', models.SlugField(null=True, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('url_path_fr', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
- ('url_path_en', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
+ ('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')),
@@ -81,23 +115,24 @@ class Migration(migrations.Migration):
('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_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, to='wagtailimages.Image', on_delete=django.db.models.deletion.SET_NULL, blank=True, related_name='+')),
+ ('image', models.ForeignKey(null=True, blank=True, on_delete=django.db.models.deletion.SET_NULL, to='wagtailimages.Image', related_name='+', verbose_name='Image')),
],
options={
- 'abstract': False,
+ 'verbose_name_plural': "Éntrées d'annuaire",
+ 'verbose_name': "Éntrée d'annuaire",
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='COFDirectoryPage',
fields=[
- ('page_ptr', models.OneToOneField(primary_key=True, parent_link=True, serialize=False, auto_created=True, to='wagtailcore.Page')),
+ ('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, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('slug_en', models.SlugField(null=True, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('url_path_fr', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
- ('url_path_en', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
+ ('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')),
@@ -107,35 +142,21 @@ class Migration(migrations.Migration):
('introduction_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')),
],
options={
- 'abstract': False,
+ 'verbose_name_plural': 'Annuaires',
+ 'verbose_name': 'Annuaire (clubs, partenaires, bons plans...)',
},
bases=('wagtailcore.page',),
),
- migrations.CreateModel(
- name='COFEvent',
- fields=[
- ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
- ('title', models.TextField(verbose_name='Titre')),
- ('title_fr', models.TextField(null=True, verbose_name='Titre')),
- ('title_en', models.TextField(null=True, verbose_name='Titre')),
- ('description', wagtail.wagtailcore.fields.RichTextField(verbose_name='Description (concise)')),
- ('description_fr', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Description (concise)')),
- ('description_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Description (concise)')),
- ('date_start', models.DateTimeField(verbose_name='Date et heure de début')),
- ('date_end', models.DateTimeField(null=True, verbose_name='Date et heure de fin')),
- ('all_day', models.BooleanField(verbose_name='Toute la journée', default=False)),
- ],
- ),
migrations.CreateModel(
name='COFPage',
fields=[
- ('page_ptr', models.OneToOneField(primary_key=True, parent_link=True, serialize=False, auto_created=True, to='wagtailcore.Page')),
+ ('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, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('slug_en', models.SlugField(null=True, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('url_path_fr', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
- ('url_path_en', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
+ ('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')),
@@ -145,20 +166,21 @@ class Migration(migrations.Migration):
('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={
- 'abstract': False,
+ 'verbose_name_plural': 'Pages normales COF',
+ 'verbose_name': 'Page normale COF',
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='COFRootPage',
fields=[
- ('page_ptr', models.OneToOneField(primary_key=True, parent_link=True, serialize=False, auto_created=True, to='wagtailcore.Page')),
+ ('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, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('slug_en', models.SlugField(null=True, verbose_name='slug', help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/', max_length=255)),
- ('url_path_fr', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
- ('url_path_en', models.TextField(null=True, blank=True, verbose_name='URL path', editable=False)),
+ ('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')),
@@ -168,8 +190,9 @@ class Migration(migrations.Migration):
('introduction_en', wagtail.wagtailcore.fields.RichTextField(null=True, verbose_name='Introduction')),
],
options={
- 'abstract': False,
+ 'verbose_name_plural': 'Racines site du COF',
+ 'verbose_name': 'Racine site du COF',
},
- bases=('wagtailcore.page',),
+ bases=('wagtailcore.page', gestioncof.cms.models.COFActuIndexMixin),
),
]
diff --git a/gestioncof/cms/models.py b/gestioncof/cms/models.py
index eb50df48..ef957b5c 100644
--- a/gestioncof/cms/models.py
+++ b/gestioncof/cms/models.py
@@ -10,8 +10,17 @@ from wagtail.wagtailimages.blocks import ImageChooserBlock
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.wagtailsnippets.models import register_snippet
+# Page pouvant afficher des actualités
+class COFActuIndexMixin():
+ @property
+ def actus(self):
+ actus = COFActuPage.objects.live().descendant_of(self)
+ events = COFActuEventPage.objects.live().descendant_of(self)
+ genactus = list(actus) + list(events)
+ return genactus
+
# Racine du site du COF
-class COFRootPage(Page):
+class COFRootPage(Page, COFActuIndexMixin):
introduction = RichTextField("Introduction")
content_panels = Page.content_panels + [
@@ -19,6 +28,10 @@ class COFRootPage(Page):
]
subpage_types = ['COFActuIndexPage', 'COFPage', 'COFDirectoryPage']
+
+ class Meta:
+ verbose_name = "Racine site du COF"
+ verbose_name_plural = "Racines site du COF"
# Page lambda du site
class COFPage(Page):
@@ -32,58 +45,95 @@ class COFPage(Page):
StreamFieldPanel('body'),
]
- subpages_types = ['COFDirectoryPage', 'COFPage']
+ subpage_types = ['COFDirectoryPage', 'COFPage']
parent_page_types = ['COFPage', 'COFRootPage']
-
-# Évènements
-@register_snippet
-class COFEvent(models.Model):
- title = models.TextField("Titre")
- description = RichTextField("Description (concise)")
- date_start = models.DateTimeField("Date et heure de début")
- date_end = models.DateTimeField("Date et heure de fin", null=True)
- all_day = models.BooleanField("Toute la journée", default=False, blank=True)
-
- panels = [
- FieldPanel("title"),
- FieldPanel("description"),
- FieldPanel("date_start"),
- FieldPanel("date_end"),
- FieldPanel("all_day"),
- ]
+ class Meta:
+ verbose_name = "Page normale COF"
+ verbose_name_plural = "Pages normales COF"
# Actualités
-class COFActuIndexPage(Page):
- subpages_types = ['COFActuPage']
+class COFActuIndexPage(Page, COFActuIndexMixin):
+ subpage_types = ['COFActuPage', 'COFActuEventPage']
parent_page_types = ['COFRootPage']
+
+ class Meta:
+ verbose_name = "Index des actualités"
+ verbose_name_plural = "Indexs des actualités"
class COFActuPage(Page):
body = RichTextField("Contenu")
date = models.DateField("Date du post")
image = models.ForeignKey(
- 'wagtailimages.Image', name="Image à la Une",
+ 'wagtailimages.Image', verbose_name="Image à la Une",
null=True, blank=True,
on_delete=models.SET_NULL, related_name='+'
)
content_panels = Page.content_panels + [
FieldPanel('date'),
-# ImageChooserPanel('image'),
+ ImageChooserPanel('image'),
FieldPanel('body', classname="full"),
]
-
- subpages_types = []
+ subpage_types = []
parent_page_types = ['COFActuIndexPage']
+ class Meta:
+ verbose_name = "Actualité simple"
+ 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)
+
+ 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']
+
+ class Meta:
+ verbose_name = "Actu liée à un évènement"
+ verbose_name_plural = "Actus liées à des évènements"
+
# Annuaires (Clubs, partenaires, bonnes adresses)
class COFDirectoryPage(Page):
introduction = RichTextField("Introduction")
- subpages_types = ['COFActuPage', 'COFDirectoryEntryPage']
+ content_panels = Page.content_panels + [
+ FieldPanel('introduction'),
+ ]
+
+ subpage_types = ['COFActuPage', 'COFDirectoryEntryPage']
parent_page_types = ['COFRootPage', 'COFPage']
+ @property
+ def entries(self):
+ entries = COFDirectoryEntryPage.objects.live().descendant_of(self)
+ return entries
+
+ class Meta:
+ verbose_name = "Annuaire (clubs, partenaires, bons plans...)"
+ verbose_name_plural = "Annuaires"
+
+
class COFDirectoryEntryPage(Page):
body = RichTextField("Description")
links = StreamField([
@@ -96,13 +146,22 @@ class COFDirectoryEntryPage(Page):
('texte', blocks.CharBlock()),
])),
])
-
+
image = models.ForeignKey(
- 'wagtailimages.Image', name="Image",
+ 'wagtailimages.Image', verbose_name="Image",
null=True, blank=True,
on_delete=models.SET_NULL, related_name='+'
)
- subpages_types = []
+ content_panels = Page.content_panels + [
+ ImageChooserPanel('image'),
+ FieldPanel('body', classname="full"),
+ StreamFieldPanel("links"),
+ ]
+
+ subpage_types = []
parent_page_types = ['COFDirectoryPage']
+ class Meta:
+ verbose_name = "Éntrée d'annuaire"
+ verbose_name_plural = "Éntrées d'annuaire"
diff --git a/gestioncof/cms/static/cofcms/config.rb b/gestioncof/cms/static/cofcms/config.rb
new file mode 100644
index 00000000..826a3727
--- /dev/null
+++ b/gestioncof/cms/static/cofcms/config.rb
@@ -0,0 +1,25 @@
+require 'compass/import-once/activate'
+# Require any additional compass plugins here.
+
+# Set this to the root of your project when deployed:
+http_path = "/"
+css_dir = "css"
+sass_dir = "sass"
+images_dir = "images"
+javascripts_dir = "js"
+
+# You can select your preferred output style here (can be overridden via the command line):
+# output_style = :expanded or :nested or :compact or :compressed
+
+# To enable relative paths to assets via compass helper functions. Uncomment:
+# relative_assets = true
+
+# To disable debugging comments that display the original location of your selectors. Uncomment:
+# line_comments = false
+
+
+# If you prefer the indented syntax, you might want to regenerate this
+# project again passing --syntax sass, or you can uncomment this:
+# preferred_syntax = :sass
+# and then run:
+# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
diff --git a/gestioncof/cms/static/cofcms/css/ie.css b/gestioncof/cms/static/cofcms/css/ie.css
new file mode 100644
index 00000000..5cd5b6c5
--- /dev/null
+++ b/gestioncof/cms/static/cofcms/css/ie.css
@@ -0,0 +1,5 @@
+/* Welcome to Compass. Use this file to write IE specific override styles.
+ * Import this file using the following HTML or equivalent:
+ * */
diff --git a/gestioncof/cms/static/cofcms/css/print.css b/gestioncof/cms/static/cofcms/css/print.css
new file mode 100644
index 00000000..b0e9e456
--- /dev/null
+++ b/gestioncof/cms/static/cofcms/css/print.css
@@ -0,0 +1,3 @@
+/* Welcome to Compass. Use this file to define print styles.
+ * Import this file using the following HTML or equivalent:
+ * */
diff --git a/gestioncof/cms/static/cofcms/css/screen.css b/gestioncof/cms/static/cofcms/css/screen.css
new file mode 100644
index 00000000..a2497901
--- /dev/null
+++ b/gestioncof/cms/static/cofcms/css/screen.css
@@ -0,0 +1,122 @@
+/* Welcome to Compass.
+ * In this file you should write your main styles. (or centralize your imports)
+ * Import this file using the following HTML or equivalent:
+ * */
+@import url("https://fonts.googleapis.com/css?family=Carter+One|Source+Sans+Pro:300,300i,700");
+/* line 5, ../../../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, embed,
+figure, figcaption, footer, header, hgroup,
+menu, nav, output, ruby, section, summary,
+time, mark, audio, video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font: inherit;
+ font-size: 100%;
+ vertical-align: baseline;
+}
+
+/* line 22, ../../../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+html {
+ line-height: 1;
+}
+
+/* line 24, ../../../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+ol, ul {
+ list-style: none;
+}
+
+/* line 26, ../../../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+/* line 28, ../../../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+caption, th, td {
+ text-align: left;
+ font-weight: normal;
+ vertical-align: middle;
+}
+
+/* line 30, ../../../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+q, blockquote {
+ quotes: none;
+}
+/* line 103, ../../../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+q:before, q:after, blockquote:before, blockquote:after {
+ content: "";
+ content: none;
+}
+
+/* line 32, ../../../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+a img {
+ border: none;
+}
+
+/* line 116, ../../../../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {
+ display: block;
+}
+
+/* line 12, ../sass/screen.scss */
+body {
+ background: #ff7869;
+ font: 17px "Source Sans Pro", "sans-serif";
+}
+
+/* line 17, ../sass/screen.scss */
+header {
+ background: #02c082;
+}
+
+/* line 21, ../sass/screen.scss */
+h1, h2 {
+ font-family: "Carter One";
+}
+
+/* line 25, ../sass/screen.scss */
+h1 {
+ font-size: 2.3em;
+}
+
+/* line 29, ../sass/screen.scss */
+a {
+ color: #fff;
+ text-decoration: none;
+}
+
+/* line 36, ../sass/screen.scss */
+header nav ul {
+ display: flex;
+}
+/* line 38, ../sass/screen.scss */
+header nav ul li {
+ display: inline-block;
+}
+/* line 40, ../sass/screen.scss */
+header nav ul li > * {
+ display: block;
+ padding: 10px 15px;
+ font-weight: bold;
+}
+/* line 45, ../sass/screen.scss */
+header nav ul li > *:hover {
+ background: #018e60;
+}
+/* line 52, ../sass/screen.scss */
+header section {
+ display: flex;
+ width: 100%;
+ justify-content: space-between;
+ align-items: stretch;
+}
diff --git a/gestioncof/cms/static/cofcms/sass/_colors.scss b/gestioncof/cms/static/cofcms/sass/_colors.scss
new file mode 100644
index 00000000..a2bc8fc2
--- /dev/null
+++ b/gestioncof/cms/static/cofcms/sass/_colors.scss
@@ -0,0 +1,4 @@
+$fond: #ff7869;
+$bandeau: #02c082;
+$aside: #ffe896;
+$titre: #e23427;
diff --git a/gestioncof/cms/static/cofcms/sass/screen.scss b/gestioncof/cms/static/cofcms/sass/screen.scss
new file mode 100644
index 00000000..76d2ef20
--- /dev/null
+++ b/gestioncof/cms/static/cofcms/sass/screen.scss
@@ -0,0 +1,58 @@
+/* Welcome to Compass.
+ * In this file you should write your main styles. (or centralize your imports)
+ * Import this file using the following HTML or equivalent:
+ * */
+
+@import url('https://fonts.googleapis.com/css?family=Carter+One|Source+Sans+Pro:300,300i,700');
+
+@import "compass/reset";
+
+@import "_colors";
+
+body {
+ background: $fond;
+ font: 17px "Source Sans Pro", "sans-serif";
+}
+
+header {
+ background: $bandeau;
+}
+
+h1, h2 {
+ font-family: "Carter One";
+}
+
+h1 {
+ font-size: 2.3em;
+}
+
+a {
+ color: #fff;
+ text-decoration: none;
+}
+
+header {
+ nav {
+ ul {
+ display: flex;
+ li {
+ display: inline-block;
+ > * {
+ display: block;
+ padding: 10px 15px;
+ font-weight: bold;
+
+ &:hover {
+ background: darken($bandeau, 10%);
+ }
+ }
+ }
+ }
+ }
+ section {
+ display: flex;
+ width: 100%;
+ justify-content: space-between;
+ align-items: stretch;
+ }
+}
diff --git a/gestioncof/cms/templates/cofcms/base.html b/gestioncof/cms/templates/cofcms/base.html
new file mode 100644
index 00000000..e6aea017
--- /dev/null
+++ b/gestioncof/cms/templates/cofcms/base.html
@@ -0,0 +1,31 @@
+{% load static menu_tags wagtailuserbar %}
+
+
+
+
+
+ {% block title %}Association des élèves de l'ENS Ulm{% endblock %}
+
+
+
+
+
+
+
+ {% block content %}{% endblock %}
+
+ {% wagtailuserbar %}
+
+
diff --git a/gestioncof/cms/templates/cofcms/base_nav.html b/gestioncof/cms/templates/cofcms/base_nav.html
new file mode 100644
index 00000000..6ec8a8ed
--- /dev/null
+++ b/gestioncof/cms/templates/cofcms/base_nav.html
@@ -0,0 +1,9 @@
+
diff --git a/gestioncof/cms/templates/cofcms/cof_actu_index_page.html b/gestioncof/cms/templates/cofcms/cof_actu_index_page.html
new file mode 100644
index 00000000..3146e6cd
--- /dev/null
+++ b/gestioncof/cms/templates/cofcms/cof_actu_index_page.html
@@ -0,0 +1,18 @@
+{% extends "cofcms/base.html" %}
+{% load wagtailimages_tags cofcms_tags %}
+
+{% block content %}
+
+ {{ page.title }}
+ {{ page.introduction|safe }}
+
+
+
+ {% for actu in page.actus %}
+
+ {{ actu.title }}
+ {{ actu.body|safe }}
+
+ {% endfor %}
+
+{% endblock %}
diff --git a/gestioncof/cms/templates/cofcms/cof_directory_page.html b/gestioncof/cms/templates/cofcms/cof_directory_page.html
new file mode 100644
index 00000000..8f0e6746
--- /dev/null
+++ b/gestioncof/cms/templates/cofcms/cof_directory_page.html
@@ -0,0 +1,34 @@
+{% extends "cofcms/base.html" %}
+{% load wagtailimages_tags cofcms_tags %}
+
+{% block content %}
+
+ {{ page.title }}
+ {{ page.introduction|safe }}
+
+
+
+ {% for entry in page.entries %}
+
+ {{ entry.title }}
+ {% if entry.image %}
+ {% image entry.image width-400 class="entry-img" %}
+ {% endif %}
+ {{ entry.body|safe }}
+ {% if entry.links %}
+
+ {% for block in entry.links %}
+ -
+ {% if block.block_type == "lien" %}
+ {{ block.value.texte }}
+ {% else %}
+ {{ block.value.texte }} :
+ {% endfor %}
+
+ {% endif %}
+
+ {% endfor %}
+
+{% endblock %}
diff --git a/gestioncof/cms/templates/cofcms/cof_page.html b/gestioncof/cms/templates/cofcms/cof_page.html
new file mode 100644
index 00000000..d6e64e56
--- /dev/null
+++ b/gestioncof/cms/templates/cofcms/cof_page.html
@@ -0,0 +1,23 @@
+{% extends "cofcms/base.html" %}
+{% load wagtailimages_tags cofcms_tags %}
+
+{% block content %}
+
+ {{ page.title }}
+ {{ page.introduction|safe }}
+
+
+
+ {% for block in page.body %}
+ {% if block.block_type == "heading" %}
+ {{ block.value }}
+ {% else %}{% if block.block_type == "paragraph" %}
+
+ {{ block.value|safe }}
+
+ {% else %}{% if block.block_type == "image" %}
+ {% image block.value width-400 %}
+ {% endif %}{% endif %}{% endif %}
+ {% endfor %}
+
+{% endblock %}
diff --git a/gestioncof/cms/templates/cofcms/cof_root_page.html b/gestioncof/cms/templates/cofcms/cof_root_page.html
new file mode 100644
index 00000000..a730ec7a
--- /dev/null
+++ b/gestioncof/cms/templates/cofcms/cof_root_page.html
@@ -0,0 +1,2 @@
+{% extends "cofcms/base.html" %}
+
diff --git a/gestioncof/cms/templatetags/__init__.py b/gestioncof/cms/templatetags/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/gestioncof/cms/templatetags/cofcms_tags.py b/gestioncof/cms/templatetags/cofcms_tags.py
new file mode 100644
index 00000000..223d9b81
--- /dev/null
+++ b/gestioncof/cms/templatetags/cofcms_tags.py
@@ -0,0 +1,12 @@
+from datetime import date
+from django import template
+from django.conf import settings
+
+import re
+
+register = template.Library()
+
+@register.filter()
+def obfuscate_mail(value):
+ val = value.replace('', '/').replace('@', 'arbse').replace('.', 'pnt')
+ return val
diff --git a/gestioncof/cms/translation.py b/gestioncof/cms/translation.py
index 705a9c1f..2be97221 100644
--- a/gestioncof/cms/translation.py
+++ b/gestioncof/cms/translation.py
@@ -1,4 +1,4 @@
-from .models import COFRootPage, COFPage, COFEvent, COFActuIndexPage, COFActuPage, COFDirectoryPage, COFDirectoryEntryPage
+from .models import COFRootPage, COFPage, COFActuEventPage, COFActuIndexPage, COFActuPage, COFDirectoryPage, COFDirectoryEntryPage
from wagtail_modeltranslation.translator import WagtailTranslationOptions
from modeltranslation.decorators import register
@@ -15,11 +15,11 @@ class COFPageTr(WagtailTranslationOptions):
'body',
)
-@register(COFEvent)
-class COFEventTr(WagtailTranslationOptions):
+@register(COFActuEventPage)
+class COFActuEventPageTr(WagtailTranslationOptions):
fields = (
- 'title',
- 'description',
+ 'chapo',
+ 'body',
)
@register(COFActuIndexPage)