Modèles plus cleans et templates principaux

This commit is contained in:
Evarin 2017-08-19 01:32:26 +02:00
parent 66fc364739
commit f5778fed2a
17 changed files with 522 additions and 94 deletions

View file

@ -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),
),
]

View file

@ -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"

View file

@ -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

View file

@ -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:
* <!--[if IE]>
* <link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
* <![endif]--> */

View file

@ -0,0 +1,3 @@
/* Welcome to Compass. Use this file to define print styles.
* Import this file using the following HTML or equivalent:
* <link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" /> */

View file

@ -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:
* <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" /> */
@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;
}

View file

@ -0,0 +1,4 @@
$fond: #ff7869;
$bandeau: #02c082;
$aside: #ffe896;
$titre: #e23427;

View file

@ -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:
* <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" /> */
@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;
}
}

View file

@ -0,0 +1,31 @@
{% load static menu_tags wagtailuserbar %}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{% block title %}Association des élèves de l'ENS Ulm{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{% static "cofcms/css/screen.css" %}"/>
</head>
<body>
<header>
<section class="top-menu">
<h1 class="cof"><a href="/">COF</a></h1>
<nav>
{% flat_menu "cof-nav-ext" template="cofcms/base_nav.html" %}
</nav>
</section>
<section class="bottom-menu">
<nav>
{% flat_menu "cof-nav-int" template="cofcms/base_nav.html" apply_active_classes=True %}
</nav>
</section>
</header>
<div class="container">
{% block content %}{% endblock %}
</div>
{% wagtailuserbar %}
</body>
</html>

View file

@ -0,0 +1,9 @@
<ul class="menu">
{% for item in menu_items %}
<li class="{{ item.active_class }}">
<a href="{{ item.href }}">
{{ item.text }}
</a>
</li>
{% endfor %}
</ul>

View file

@ -0,0 +1,18 @@
{% extends "cofcms/base.html" %}
{% load wagtailimages_tags cofcms_tags %}
{% block content %}
<section class="intro">
<h1>{{ page.title }}</h1>
<div>{{ page.introduction|safe }}</div>
</section>
<section class="actulist">
{% for actu in page.actus %}
<article class="actu">
<h2>{{ actu.title }}</h2>
{{ actu.body|safe }}
</article>
{% endfor %}
</section>
{% endblock %}

View file

@ -0,0 +1,34 @@
{% extends "cofcms/base.html" %}
{% load wagtailimages_tags cofcms_tags %}
{% block content %}
<section class="intro">
<h1>{{ page.title }}</h1>
<div>{{ page.introduction|safe }}</div>
</section>
<section class="directory">
{% for entry in page.entries %}
<article class="entry" id="{{ entry.slug }}">
<h2>{{ entry.title }}</h2>
{% if entry.image %}
{% image entry.image width-400 class="entry-img" %}
{% endif %}
<div class="desc">{{ entry.body|safe }}</div>
{% if entry.links %}
<ul class="links">
{% for block in entry.links %}
<li>
{% if block.block_type == "lien" %}
<a href="{{ block.value.url }}">{{ block.value.texte }}</a>
{% else %}
{{ block.value.texte }} : <button data-mref="{{ block.value.email|obfuscate_mail }}" class="mail-contact">Afficher l'adresse mail</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</article>
{% endfor %}
</section>
{% endblock %}

View file

@ -0,0 +1,23 @@
{% extends "cofcms/base.html" %}
{% load wagtailimages_tags cofcms_tags %}
{% block content %}
<section class="intro">
<h1>{{ page.title }}</h1>
<div>{{ page.introduction|safe }}</div>
</section>
<section class="pagecontent">
{% for block in page.body %}
{% if block.block_type == "heading" %}
<h2>{{ block.value }}</h2>
{% else %}{% if block.block_type == "paragraph" %}
<article class="paragraph">
{{ block.value|safe }}
</article>
{% else %}{% if block.block_type == "image" %}
{% image block.value width-400 %}
{% endif %}{% endif %}{% endif %}
{% endfor %}
</section>
{% endblock %}

View file

@ -0,0 +1,2 @@
{% extends "cofcms/base.html" %}

View file

View file

@ -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

View file

@ -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)