Merge branch 'Evarin/Wagtail2' into 'master'

Migration vers Wagtail 2.3 et Wagtail-modeltranslation 0.9

See merge request klub-dev-ens/gestioCOF!349
This commit is contained in:
Ludovic Stephan 2019-02-18 22:16:45 +01:00
commit f90663bf97
19 changed files with 2560 additions and 3530 deletions

View file

@ -65,6 +65,12 @@ INSTALLED_APPS = [
"django.contrib.sites", "django.contrib.sites",
"django.contrib.messages", "django.contrib.messages",
"django.contrib.staticfiles", "django.contrib.staticfiles",
# Must be before django admin
# https://github.com/infoportugal/wagtail-modeltranslation/issues/193
"wagtail_modeltranslation",
"wagtail_modeltranslation.makemigrations",
"wagtail_modeltranslation.migrate",
"modeltranslation",
"django.contrib.admin", "django.contrib.admin",
"django.contrib.admindocs", "django.contrib.admindocs",
"bda", "bda",
@ -78,21 +84,20 @@ INSTALLED_APPS = [
"widget_tweaks", "widget_tweaks",
"custommail", "custommail",
"djconfig", "djconfig",
"wagtail.wagtailforms", "wagtail.contrib.forms",
"wagtail.wagtailredirects", "wagtail.contrib.redirects",
"wagtail.wagtailembeds", "wagtail.embeds",
"wagtail.wagtailsites", "wagtail.sites",
"wagtail.wagtailusers", "wagtail.users",
"wagtail.wagtailsnippets", "wagtail.snippets",
"wagtail.wagtaildocs", "wagtail.documents",
"wagtail.wagtailimages", "wagtail.images",
"wagtail.wagtailsearch", "wagtail.search",
"wagtail.wagtailadmin", "wagtail.admin",
"wagtail.wagtailcore", "wagtail.core",
"wagtail.contrib.modeladmin", "wagtail.contrib.modeladmin",
"wagtail.contrib.wagtailroutablepage", "wagtail.contrib.routable_page",
"wagtailmenus", "wagtailmenus",
"wagtail_modeltranslation",
"modelcluster", "modelcluster",
"taggit", "taggit",
"kfet.auth", "kfet.auth",
@ -113,8 +118,8 @@ MIDDLEWARE = [
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.middleware.security.SecurityMiddleware", "django.middleware.security.SecurityMiddleware",
"djconfig.middleware.DjConfigMiddleware", "djconfig.middleware.DjConfigMiddleware",
"wagtail.wagtailcore.middleware.SiteMiddleware", "wagtail.core.middleware.SiteMiddleware",
"wagtail.wagtailredirects.middleware.RedirectMiddleware", "wagtail.contrib.redirects.middleware.RedirectMiddleware",
"django.middleware.locale.LocaleMiddleware", "django.middleware.locale.LocaleMiddleware",
] ]

View file

@ -10,9 +10,9 @@ from django.contrib import admin
from django.contrib.auth import views as django_views from django.contrib.auth import views as django_views
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django_cas_ng import views as django_cas_views from django_cas_ng import views as django_cas_views
from wagtail.wagtailadmin import urls as wagtailadmin_urls from wagtail.admin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls from wagtail.core import urls as wagtail_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls from wagtail.documents import urls as wagtaildocs_urls
from gestioncof import csv_views, views as gestioncof_views from gestioncof import csv_views, views as gestioncof_views
from gestioncof.autocomplete import autocomplete from gestioncof.autocomplete import autocomplete

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,696 @@
[
{
"model": "wagtailcore.page",
"pk": 27,
"fields": {
"path": "000100010002",
"depth": 3,
"numchild": 3,
"title": "Site du COF",
"title_fr": "Site du COF",
"title_en": null,
"draft_title": "Site du COF",
"slug": "site",
"slug_fr": "site",
"slug_en": null,
"content_type": [
"cofcms",
"cofrootpage"
],
"live": true,
"has_unpublished_changes": false,
"url_path": "/global/site/",
"url_path_fr": "/global/site/",
"url_path_en": "/global/site/",
"owner": [
"root"
],
"seo_title": "",
"seo_title_fr": null,
"seo_title_en": null,
"show_in_menus": false,
"search_description": "",
"search_description_fr": "",
"search_description_en": "",
"go_live_at": null,
"expire_at": null,
"expired": false,
"locked": false,
"first_published_at": "2019-02-04T20:54:14.724Z",
"last_published_at": "2019-02-04T20:54:14.724Z",
"latest_revision_created_at": null,
"live_revision": null
}
},
{
"model": "wagtailcore.page",
"pk": 28,
"fields": {
"path": "0001000100020001",
"depth": 4,
"numchild": 0,
"title": "Pr\u00e9sentation",
"title_fr": "Pr\u00e9sentation",
"title_en": "Presentation",
"draft_title": "Pr\u00e9sentation",
"slug": "pr\u00e9sentation",
"slug_fr": "pr\u00e9sentation",
"slug_en": null,
"content_type": [
"cofcms",
"cofpage"
],
"live": true,
"has_unpublished_changes": false,
"url_path": "/global/site/pr\u00e9sentation/",
"url_path_fr": "/global/site/pr\u00e9sentation/",
"url_path_en": "/global/site/pr\u00e9sentation/",
"owner": [
"root"
],
"seo_title": "",
"seo_title_fr": null,
"seo_title_en": null,
"show_in_menus": true,
"search_description": "",
"search_description_fr": "",
"search_description_en": "",
"go_live_at": null,
"expire_at": null,
"expired": false,
"locked": false,
"first_published_at": "2019-02-04T20:55:06.574Z",
"last_published_at": "2019-02-04T21:42:00.461Z",
"latest_revision_created_at": null,
"live_revision": null
}
},
{
"model": "wagtailcore.page",
"pk": 29,
"fields": {
"path": "0001000100020002",
"depth": 4,
"numchild": 2,
"title": "Actualit\u00e9s",
"title_fr": "Actualit\u00e9s",
"title_en": "News",
"draft_title": "Actualit\u00e9s",
"slug": "actualit\u00e9s",
"slug_fr": "actualit\u00e9s",
"slug_en": "news",
"content_type": [
"cofcms",
"cofactuindexpage"
],
"live": true,
"has_unpublished_changes": false,
"url_path": "/global/site/actualit\u00e9s/",
"url_path_fr": "/global/site/actualit\u00e9s/",
"url_path_en": "/global/site/news/",
"owner": [
"root"
],
"seo_title": "",
"seo_title_fr": null,
"seo_title_en": null,
"show_in_menus": true,
"search_description": "",
"search_description_fr": "",
"search_description_en": "",
"go_live_at": null,
"expire_at": null,
"expired": false,
"locked": false,
"first_published_at": "2019-02-04T20:58:47.657Z",
"last_published_at": "2019-02-04T21:43:55.575Z",
"latest_revision_created_at": null,
"live_revision": null
}
},
{
"model": "wagtailcore.page",
"pk": 30,
"fields": {
"path": "00010001000200020001",
"depth": 5,
"numchild": 0,
"title": "Grosse teuf en K-F\u00eat",
"title_fr": "Grosse teuf en K-F\u00eat",
"title_en": "Big feast in K-F\u00eat",
"draft_title": "Grosse teuf en K-F\u00eat",
"slug": "grosse-teuf-en-k-f\u00eat",
"slug_fr": "grosse-teuf-en-k-f\u00eat",
"slug_en": "big-feast-in-k-f\u00eat",
"content_type": [
"cofcms",
"cofactupage"
],
"live": true,
"has_unpublished_changes": false,
"url_path": "/global/site/actualit\u00e9s/grosse-teuf-en-k-f\u00eat/",
"url_path_fr": "/global/site/actualit\u00e9s/grosse-teuf-en-k-f\u00eat/",
"url_path_en": "/global/site/news/big-feast-in-k-f\u00eat/",
"owner": [
"root"
],
"seo_title": "",
"seo_title_fr": null,
"seo_title_en": null,
"show_in_menus": false,
"search_description": "",
"search_description_fr": "",
"search_description_en": "",
"go_live_at": null,
"expire_at": null,
"expired": false,
"locked": false,
"first_published_at": "2019-02-04T21:04:39.422Z",
"last_published_at": "2019-02-04T21:04:39.422Z",
"latest_revision_created_at": null,
"live_revision": null
}
},
{
"model": "wagtailcore.page",
"pk": 31,
"fields": {
"path": "00010001000200020002",
"depth": 5,
"numchild": 0,
"title": "Les 48h des Arts",
"title_fr": "Les 48h des Arts",
"title_en": null,
"draft_title": "Les 48h des Arts",
"slug": "les-48h-des-arts",
"slug_fr": "les-48h-des-arts",
"slug_en": null,
"content_type": [
"cofcms",
"cofactupage"
],
"live": true,
"has_unpublished_changes": false,
"url_path": "/global/site/actualit\u00e9s/les-48h-des-arts/",
"url_path_fr": "/global/site/actualit\u00e9s/les-48h-des-arts/",
"url_path_en": "/global/site/news/les-48h-des-arts/",
"owner": [
"root"
],
"seo_title": "",
"seo_title_fr": null,
"seo_title_en": null,
"show_in_menus": false,
"search_description": "",
"search_description_fr": "",
"search_description_en": "",
"go_live_at": null,
"expire_at": null,
"expired": false,
"locked": false,
"first_published_at": "2019-02-04T21:05:27.190Z",
"last_published_at": "2019-02-04T21:05:27.190Z",
"latest_revision_created_at": null,
"live_revision": null
}
},
{
"model": "wagtailcore.page",
"pk": 32,
"fields": {
"path": "0001000100020003",
"depth": 4,
"numchild": 1,
"title": "Clubs",
"title_fr": "Clubs",
"title_en": null,
"draft_title": "Clubs",
"slug": "clubs",
"slug_fr": "clubs",
"slug_en": null,
"content_type": [
"cofcms",
"cofdirectorypage"
],
"live": true,
"has_unpublished_changes": false,
"url_path": "/global/site/clubs/",
"url_path_fr": "/global/site/clubs/",
"url_path_en": "/global/site/clubs/",
"owner": [
"root"
],
"seo_title": "",
"seo_title_fr": null,
"seo_title_en": null,
"show_in_menus": true,
"search_description": "",
"search_description_fr": "",
"search_description_en": "",
"go_live_at": null,
"expire_at": null,
"expired": false,
"locked": false,
"first_published_at": "2019-02-04T21:44:23.382Z",
"last_published_at": "2019-02-04T21:44:23.382Z",
"latest_revision_created_at": null,
"live_revision": null
}
},
{
"model": "wagtailcore.page",
"pk": 33,
"fields": {
"path": "00010001000200030001",
"depth": 5,
"numchild": 0,
"title": "Arts Plastiques",
"title_fr": "Arts Plastiques",
"title_en": null,
"draft_title": "Arts Plastiques",
"slug": "arts-plastiques",
"slug_fr": "arts-plastiques",
"slug_en": null,
"content_type": [
"cofcms",
"cofdirectoryentrypage"
],
"live": true,
"has_unpublished_changes": false,
"url_path": "/global/site/clubs/arts-plastiques/",
"url_path_fr": "/global/site/clubs/arts-plastiques/",
"url_path_en": "/global/site/clubs/arts-plastiques/",
"owner": [
"root"
],
"seo_title": "",
"seo_title_fr": null,
"seo_title_en": null,
"show_in_menus": false,
"search_description": "",
"search_description_fr": "",
"search_description_en": "",
"go_live_at": null,
"expire_at": null,
"expired": false,
"locked": false,
"first_published_at": "2019-02-04T21:48:58.013Z",
"last_published_at": "2019-02-04T21:48:58.013Z",
"latest_revision_created_at": null,
"live_revision": null
}
},
{
"model": "wagtailcore.collection",
"pk": 3,
"fields": {
"path": "00010002",
"depth": 2,
"numchild": 0,
"name": "COF"
}
},
{
"model": "cofcms.cofrootpage",
"pk": 27,
"fields": {
"introduction": "<p>Bienvenue sur le site du COF !</p>",
"introduction_fr": "<p>Bienvenue sur le site du COF !</p>",
"introduction_en": "<p></p>"
}
},
{
"model": "cofcms.cofpage",
"pk": 28,
"fields": {
"body": "[{\"type\": \"paragraph\", \"id\": \"0b3a92bd-1e27-433b-842c-ab4f0a2750ad\", \"value\": \"<p>On est le COF on est tout gentil</p>\"}]",
"body_fr": "[{\"type\": \"paragraph\", \"id\": \"0b3a92bd-1e27-433b-842c-ab4f0a2750ad\", \"value\": \"<p>On est le COF on est tout gentil</p>\"}]",
"body_en": "[]"
}
},
{
"model": "cofcms.cofactuindexpage",
"pk": 29,
"fields": {}
},
{
"model": "cofcms.cofactupage",
"pk": 30,
"fields": {
"chapo": "Grosse teuf en K-F\u00eat",
"chapo_fr": "Grosse teuf en K-F\u00eat",
"chapo_en": "Big typar in K-F\u00eat",
"body": "<p>Viens boire en K-F\u00eat</p>",
"body_fr": "<p>Viens boire en K-F\u00eat</p>",
"body_en": "<p></p>",
"image": 34,
"is_event": true,
"date_start": "2019-02-07T21:00:00Z",
"date_end": "2019-02-08T03:00:00Z",
"all_day": false
}
},
{
"model": "cofcms.cofactupage",
"pk": 31,
"fields": {
"chapo": "",
"chapo_fr": "",
"chapo_en": "",
"body": "<p>C&#x27;est l&#x27;art</p>",
"body_fr": "<p>C&#x27;est l&#x27;art</p>",
"body_en": "<p></p>",
"image": 37,
"is_event": true,
"date_start": "2019-03-16T21:05:00Z",
"date_end": "2019-03-24T21:05:00Z",
"all_day": true
}
},
{
"model": "cofcms.cofdirectorypage",
"pk": 32,
"fields": {
"introduction": "<p>Ce sont les clubs</p>",
"introduction_fr": "<p>Ce sont les clubs</p>",
"introduction_en": "<p></p>",
"alphabetique": true
}
},
{
"model": "cofcms.cofdirectoryentrypage",
"pk": 33,
"fields": {
"body": "<p>Club Arts Plastiques</p>",
"body_fr": "<p>Club Arts Plastiques</p>",
"body_en": "<p></p>",
"links": "[{\"type\": \"contact\", \"id\": \"cf198b98-0b84-4f38-ac00-6d883cfd60a4\", \"value\": {\"email\": \"artsplastiques@ens.fr\", \"texte\": \"Liste Mails\"}}]",
"links_fr": "[{\"type\": \"contact\", \"id\": \"cf198b98-0b84-4f38-ac00-6d883cfd60a4\", \"value\": {\"email\": \"artsplastiques@ens.fr\", \"texte\": \"Liste Mails\"}}]",
"links_en": "[]",
"image": 37
}
},
{
"model": "wagtailimages.image",
"pk": 33,
"fields": {
"collection": 3,
"title": "COF-17",
"file": "original_images/cof-768x576.jpg",
"width": 768,
"height": 576,
"created_at": "2018-01-22T18:49:25.647Z",
"uploaded_by_user": [
"root"
],
"focal_point_x": null,
"focal_point_y": null,
"focal_point_width": null,
"focal_point_height": null,
"file_size": 132330,
"file_hash": ""
}
},
{
"model": "wagtailimages.image",
"pk": 34,
"fields": {
"collection": 3,
"title": "Singin in the RENS",
"file": "original_images/singin.jpg",
"width": 682,
"height": 361,
"created_at": "2018-01-22T19:13:49.753Z",
"uploaded_by_user": [
"root"
],
"focal_point_x": null,
"focal_point_y": null,
"focal_point_width": null,
"focal_point_height": null,
"file_size": null,
"file_hash": ""
}
},
{
"model": "wagtailimages.image",
"pk": 35,
"fields": {
"collection": 3,
"title": "Retour du Bur\u00f4",
"file": "original_images/retour.jpg",
"width": 614,
"height": 211,
"created_at": "2018-01-22T19:16:25.375Z",
"uploaded_by_user": [
"root"
],
"focal_point_x": null,
"focal_point_y": null,
"focal_point_width": null,
"focal_point_height": null,
"file_size": null,
"file_hash": ""
}
},
{
"model": "wagtailimages.image",
"pk": 36,
"fields": {
"collection": 3,
"title": "elections 18",
"file": "original_images/elections.png",
"width": 850,
"height": 406,
"created_at": "2018-01-22T19:21:31.954Z",
"uploaded_by_user": [
"root"
],
"focal_point_x": null,
"focal_point_y": null,
"focal_point_width": null,
"focal_point_height": null,
"file_size": null,
"file_hash": ""
}
},
{
"model": "wagtailimages.image",
"pk": 37,
"fields": {
"collection": 3,
"title": "Arts Plastiques",
"file": "original_images/ArtsPla.png",
"width": 150,
"height": 150,
"created_at": "2018-01-22T20:11:56.461Z",
"uploaded_by_user": [
"root"
],
"focal_point_x": null,
"focal_point_y": null,
"focal_point_width": null,
"focal_point_height": null,
"file_size": null,
"file_hash": ""
}
},
{
"model": "wagtailimages.image",
"pk": 38,
"fields": {
"collection": 3,
"title": "MGEN",
"file": "original_images/MGEN.jpg",
"width": 300,
"height": 204,
"created_at": "2018-01-22T20:20:41.712Z",
"uploaded_by_user": [
"root"
],
"focal_point_x": null,
"focal_point_y": null,
"focal_point_width": null,
"focal_point_height": null,
"file_size": null,
"file_hash": ""
}
},
{
"model": "wagtailimages.image",
"pk": 39,
"fields": {
"collection": 3,
"title": "MAIF",
"file": "original_images/Logo-MAIF.gif",
"width": 300,
"height": 290,
"created_at": "2018-01-28T16:20:13.828Z",
"uploaded_by_user": [
"root"
],
"focal_point_x": null,
"focal_point_y": null,
"focal_point_width": null,
"focal_point_height": null,
"file_size": null,
"file_hash": ""
}
},
{
"model": "wagtailmenus.flatmenuitem",
"pk": 7,
"fields": {
"sort_order": 0,
"link_page": null,
"link_url": "https://www.cof.ens.fr/bda/",
"url_append": "",
"handle": "",
"link_text": "BdA",
"allow_subnav": false,
"menu": 2
}
},
{
"model": "wagtailmenus.flatmenuitem",
"pk": 8,
"fields": {
"sort_order": 1,
"link_page": null,
"link_url": "https://www.cof.ens.fr/bds/",
"url_append": "",
"handle": "",
"link_text": "BdS",
"allow_subnav": false,
"menu": 2
}
},
{
"model": "wagtailmenus.flatmenuitem",
"pk": 9,
"fields": {
"sort_order": 2,
"link_page": null,
"link_url": "https://www.cof.ens.fr/gestion",
"url_append": "",
"handle": "",
"link_text": "GestioCOF",
"allow_subnav": false,
"menu": 2
}
},
{
"model": "wagtailmenus.flatmenuitem",
"pk": 10,
"fields": {
"sort_order": 3,
"link_page": null,
"link_url": "https://www.cof.ens.fr/bocal",
"url_append": "",
"handle": "",
"link_text": "Le BOcal",
"allow_subnav": false,
"menu": 2
}
},
{
"model": "wagtailmenus.flatmenuitem",
"pk": 11,
"fields": {
"sort_order": 4,
"link_page": null,
"link_url": "https://photos.cof.ens.fr/",
"url_append": "",
"handle": "",
"link_text": "Serveur photos",
"allow_subnav": false,
"menu": 2
}
},
{
"model": "wagtailmenus.flatmenuitem",
"pk": 12,
"fields": {
"sort_order": 5,
"link_page": null,
"link_url": "https://www.eleves.ens.fr",
"url_append": "",
"handle": "",
"link_text": "Services \u00e9l\u00e8ves ENS",
"allow_subnav": false,
"menu": 2
}
},
{
"model": "wagtailmenus.flatmenuitem",
"pk": 20,
"fields": {
"sort_order": 0,
"link_page": 28,
"link_url": null,
"url_append": "",
"handle": "",
"link_text": "",
"allow_subnav": false,
"menu": 4
}
},
{
"model": "wagtailmenus.flatmenuitem",
"pk": 21,
"fields": {
"sort_order": 1,
"link_page": 29,
"link_url": null,
"url_append": "",
"handle": "",
"link_text": "",
"allow_subnav": false,
"menu": 4
}
},
{
"model": "wagtailmenus.flatmenuitem",
"pk": 22,
"fields": {
"sort_order": 2,
"link_page": 32,
"link_url": null,
"url_append": "",
"handle": "",
"link_text": "",
"allow_subnav": false,
"menu": 4
}
},
{
"model": "wagtailmenus.flatmenu",
"pk": 2,
"fields": {
"site": [
"localhost",
8000
],
"title": "COF - liens externes",
"handle": "cof-nav-ext",
"heading": "",
"max_levels": 1,
"use_specific": 1
}
},
{
"model": "wagtailmenus.flatmenu",
"pk": 4,
"fields": {
"site": [
"localhost",
8000
],
"title": "COF - liens internes",
"handle": "cof-nav-int",
"heading": "",
"max_levels": 1,
"use_specific": 1
}
}
]

View file

@ -1,11 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-20 19:10 # Generated by Django 1.11.18 on 2019-02-04 20:45
from __future__ import unicode_literals from __future__ import unicode_literals
import django.db.models.deletion import django.db.models.deletion
import wagtail.wagtailcore.blocks import wagtail.contrib.routable_page.models
import wagtail.wagtailcore.fields import wagtail.core.blocks
import wagtail.wagtailimages.blocks import wagtail.core.fields
import wagtail.images.blocks
from django.db import migrations, models from django.db import migrations, models
import gestioncof.cms.models import gestioncof.cms.models
@ -16,8 +17,8 @@ class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [
("wagtailcore", "0033_remove_golive_expiry_help_text"), ("wagtailimages", "0021_image_file_hash"),
("wagtailimages", "0019_delete_filter"), ("wagtailcore", "0040_page_draft_title"),
] ]
operations = [ operations = [
@ -34,89 +35,7 @@ class Migration(migrations.Migration):
serialize=False, serialize=False,
to="wagtailcore.Page", to="wagtailcore.Page",
), ),
), )
(
"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(
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(
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(
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(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"url_path_en",
models.TextField(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"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(
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(
blank=True, null=True, verbose_name="search description"
),
),
(
"search_description_en",
models.TextField(
blank=True, null=True, verbose_name="search description"
),
),
], ],
options={ options={
"verbose_name": "Index des actualités", "verbose_name": "Index des actualités",
@ -138,88 +57,6 @@ class Migration(migrations.Migration):
to="wagtailcore.Page", to="wagtailcore.Page",
), ),
), ),
(
"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(
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(
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(
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(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"url_path_en",
models.TextField(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"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(
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(
blank=True, null=True, verbose_name="search description"
),
),
(
"search_description_en",
models.TextField(
blank=True, null=True, verbose_name="search description"
),
),
( (
"chapo", "chapo",
models.TextField(blank=True, verbose_name="Description rapide"), models.TextField(blank=True, verbose_name="Description rapide"),
@ -236,19 +73,16 @@ class Migration(migrations.Migration):
blank=True, null=True, verbose_name="Description rapide" blank=True, null=True, verbose_name="Description rapide"
), ),
), ),
( ("body", wagtail.core.fields.RichTextField(verbose_name="Contenu")),
"body",
wagtail.wagtailcore.fields.RichTextField(verbose_name="Contenu"),
),
( (
"body_fr", "body_fr",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(
null=True, verbose_name="Contenu" null=True, verbose_name="Contenu"
), ),
), ),
( (
"body_en", "body_en",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(
null=True, verbose_name="Contenu" null=True, verbose_name="Contenu"
), ),
), ),
@ -286,7 +120,10 @@ class Migration(migrations.Migration):
), ),
], ],
options={"verbose_name": "Actualité", "verbose_name_plural": "Actualités"}, options={"verbose_name": "Actualité", "verbose_name_plural": "Actualités"},
bases=("wagtailcore.page",), bases=(
wagtail.contrib.routable_page.models.RoutablePageMixin,
"wagtailcore.page",
),
), ),
migrations.CreateModel( migrations.CreateModel(
name="COFDirectoryEntryPage", name="COFDirectoryEntryPage",
@ -302,228 +139,117 @@ class Migration(migrations.Migration):
to="wagtailcore.Page", to="wagtailcore.Page",
), ),
), ),
( ("body", wagtail.core.fields.RichTextField(verbose_name="Description")),
"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(
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(
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(
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(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"url_path_en",
models.TextField(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"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(
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(
blank=True, null=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_fr", "body_fr",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(
null=True, verbose_name="Description" null=True, verbose_name="Description"
), ),
), ),
( (
"body_en", "body_en",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(
null=True, verbose_name="Description" null=True, verbose_name="Description"
), ),
), ),
( (
"links", "links",
wagtail.wagtailcore.fields.StreamField( wagtail.core.fields.StreamField(
( [
( (
"lien", "lien",
wagtail.wagtailcore.blocks.StructBlock( wagtail.core.blocks.StructBlock(
( [
( (
"url", "url",
wagtail.wagtailcore.blocks.URLBlock( wagtail.core.blocks.URLBlock(required=True),
required=True
),
), ),
( ("texte", wagtail.core.blocks.CharBlock()),
"texte", ]
wagtail.wagtailcore.blocks.CharBlock(),
),
)
), ),
), ),
( (
"contact", "contact",
wagtail.wagtailcore.blocks.StructBlock( wagtail.core.blocks.StructBlock(
( [
( (
"email", "email",
wagtail.wagtailcore.blocks.EmailBlock( wagtail.core.blocks.EmailBlock(
required=True required=True
), ),
), ),
( ("texte", wagtail.core.blocks.CharBlock()),
"texte", ]
wagtail.wagtailcore.blocks.CharBlock(),
),
)
), ),
), ),
) ]
), ),
), ),
( (
"links_fr", "links_fr",
wagtail.wagtailcore.fields.StreamField( wagtail.core.fields.StreamField(
( [
( (
"lien", "lien",
wagtail.wagtailcore.blocks.StructBlock( wagtail.core.blocks.StructBlock(
( [
( (
"url", "url",
wagtail.wagtailcore.blocks.URLBlock( wagtail.core.blocks.URLBlock(required=True),
required=True
),
), ),
( ("texte", wagtail.core.blocks.CharBlock()),
"texte", ]
wagtail.wagtailcore.blocks.CharBlock(),
),
)
), ),
), ),
( (
"contact", "contact",
wagtail.wagtailcore.blocks.StructBlock( wagtail.core.blocks.StructBlock(
( [
( (
"email", "email",
wagtail.wagtailcore.blocks.EmailBlock( wagtail.core.blocks.EmailBlock(
required=True required=True
), ),
), ),
( ("texte", wagtail.core.blocks.CharBlock()),
"texte", ]
wagtail.wagtailcore.blocks.CharBlock(),
),
)
), ),
), ),
), ],
null=True, null=True,
), ),
), ),
( (
"links_en", "links_en",
wagtail.wagtailcore.fields.StreamField( wagtail.core.fields.StreamField(
( [
( (
"lien", "lien",
wagtail.wagtailcore.blocks.StructBlock( wagtail.core.blocks.StructBlock(
( [
( (
"url", "url",
wagtail.wagtailcore.blocks.URLBlock( wagtail.core.blocks.URLBlock(required=True),
required=True
),
), ),
( ("texte", wagtail.core.blocks.CharBlock()),
"texte", ]
wagtail.wagtailcore.blocks.CharBlock(),
),
)
), ),
), ),
( (
"contact", "contact",
wagtail.wagtailcore.blocks.StructBlock( wagtail.core.blocks.StructBlock(
( [
( (
"email", "email",
wagtail.wagtailcore.blocks.EmailBlock( wagtail.core.blocks.EmailBlock(
required=True required=True
), ),
), ),
( ("texte", wagtail.core.blocks.CharBlock()),
"texte", ]
wagtail.wagtailcore.blocks.CharBlock(),
),
)
), ),
), ),
), ],
null=True, null=True,
), ),
), ),
@ -540,8 +266,8 @@ class Migration(migrations.Migration):
), ),
], ],
options={ options={
"verbose_name": "Éntrée d'annuaire", "verbose_name": "Entrée d'annuaire",
"verbose_name_plural": "Éntrées d'annuaire", "verbose_name_plural": "Entrées d'annuaire",
}, },
bases=("wagtailcore.page",), bases=("wagtailcore.page",),
), ),
@ -559,106 +285,28 @@ class Migration(migrations.Migration):
to="wagtailcore.Page", to="wagtailcore.Page",
), ),
), ),
(
"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(
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(
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(
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(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"url_path_en",
models.TextField(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"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(
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(
blank=True, null=True, verbose_name="search description"
),
),
(
"search_description_en",
models.TextField(
blank=True, null=True, verbose_name="search description"
),
),
( (
"introduction", "introduction",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(verbose_name="Introduction"),
verbose_name="Introduction"
),
), ),
( (
"introduction_fr", "introduction_fr",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(
null=True, verbose_name="Introduction" null=True, verbose_name="Introduction"
), ),
), ),
( (
"introduction_en", "introduction_en",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(
null=True, verbose_name="Introduction" null=True, verbose_name="Introduction"
), ),
), ),
(
"alphabetique",
models.BooleanField(
default=True, verbose_name="Tri par ordre alphabétique ?"
),
),
], ],
options={ options={
"verbose_name": "Annuaire (clubs, partenaires, bons plans...)", "verbose_name": "Annuaire (clubs, partenaires, bons plans...)",
@ -680,132 +328,101 @@ class Migration(migrations.Migration):
to="wagtailcore.Page", to="wagtailcore.Page",
), ),
), ),
(
"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(
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(
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(
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(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"url_path_en",
models.TextField(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"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(
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(
blank=True, null=True, verbose_name="search description"
),
),
(
"search_description_en",
models.TextField(
blank=True, null=True, verbose_name="search description"
),
),
( (
"body", "body",
wagtail.wagtailcore.fields.StreamField( wagtail.core.fields.StreamField(
( [
( (
"heading", "heading",
wagtail.wagtailcore.blocks.CharBlock( wagtail.core.blocks.CharBlock(classname="full title"),
classname="full title" ),
("paragraph", wagtail.core.blocks.RichTextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
(
"iframe",
wagtail.core.blocks.StructBlock(
[
(
"url",
wagtail.core.blocks.URLBlock(
"Adresse de la page"
),
),
(
"height",
wagtail.core.blocks.CharBlock(
"Hauteur (en pixels)"
),
),
]
), ),
), ),
("paragraph", wagtail.wagtailcore.blocks.RichTextBlock()), ]
("image", wagtail.wagtailimages.blocks.ImageChooserBlock()),
)
), ),
), ),
( (
"body_fr", "body_fr",
wagtail.wagtailcore.fields.StreamField( wagtail.core.fields.StreamField(
( [
( (
"heading", "heading",
wagtail.wagtailcore.blocks.CharBlock( wagtail.core.blocks.CharBlock(classname="full title"),
classname="full title" ),
("paragraph", wagtail.core.blocks.RichTextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
(
"iframe",
wagtail.core.blocks.StructBlock(
[
(
"url",
wagtail.core.blocks.URLBlock(
"Adresse de la page"
),
),
(
"height",
wagtail.core.blocks.CharBlock(
"Hauteur (en pixels)"
),
),
]
), ),
), ),
("paragraph", wagtail.wagtailcore.blocks.RichTextBlock()), ],
("image", wagtail.wagtailimages.blocks.ImageChooserBlock()),
),
null=True, null=True,
), ),
), ),
( (
"body_en", "body_en",
wagtail.wagtailcore.fields.StreamField( wagtail.core.fields.StreamField(
( [
( (
"heading", "heading",
wagtail.wagtailcore.blocks.CharBlock( wagtail.core.blocks.CharBlock(classname="full title"),
classname="full title" ),
("paragraph", wagtail.core.blocks.RichTextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
(
"iframe",
wagtail.core.blocks.StructBlock(
[
(
"url",
wagtail.core.blocks.URLBlock(
"Adresse de la page"
),
),
(
"height",
wagtail.core.blocks.CharBlock(
"Hauteur (en pixels)"
),
),
]
), ),
), ),
("paragraph", wagtail.wagtailcore.blocks.RichTextBlock()), ],
("image", wagtail.wagtailimages.blocks.ImageChooserBlock()),
),
null=True, null=True,
), ),
), ),
@ -830,103 +447,19 @@ class Migration(migrations.Migration):
to="wagtailcore.Page", to="wagtailcore.Page",
), ),
), ),
(
"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(
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(
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(
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(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"url_path_en",
models.TextField(
blank=True, editable=False, null=True, verbose_name="URL path"
),
),
(
"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(
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(
blank=True, null=True, verbose_name="search description"
),
),
(
"search_description_en",
models.TextField(
blank=True, null=True, verbose_name="search description"
),
),
( (
"introduction", "introduction",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(verbose_name="Introduction"),
verbose_name="Introduction"
),
), ),
( (
"introduction_fr", "introduction_fr",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(
null=True, verbose_name="Introduction" null=True, verbose_name="Introduction"
), ),
), ),
( (
"introduction_en", "introduction_en",
wagtail.wagtailcore.fields.RichTextField( wagtail.core.fields.RichTextField(
null=True, verbose_name="Introduction" null=True, verbose_name="Introduction"
), ),
), ),

View file

@ -1,160 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-04-28 13:46
from __future__ import unicode_literals
import django.db.models.deletion
import wagtail.contrib.wagtailroutablepage.models
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailcore", "0039_collectionviewrestriction"),
("cofcms", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="COFUtilPage",
fields=[
(
"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",
),
)
],
options={
"verbose_name": "Page utilitaire",
"verbose_name_plural": "Pages utilitaires",
},
bases=(
wagtail.contrib.wagtailroutablepage.models.RoutablePageMixin,
"wagtailcore.page",
),
),
migrations.AlterModelOptions(
name="cofdirectoryentrypage",
options={
"verbose_name": "Entrée d'annuaire",
"verbose_name_plural": "Entrées d'annuaire",
},
),
migrations.AddField(
model_name="cofdirectorypage",
name="alphabetique",
field=models.BooleanField(
default=True, verbose_name="Tri par ordre alphabétique ?"
),
),
migrations.AlterField(
model_name="cofpage",
name="body",
field=wagtail.wagtailcore.fields.StreamField(
(
(
"heading",
wagtail.wagtailcore.blocks.CharBlock(classname="full title"),
),
("paragraph", wagtail.wagtailcore.blocks.RichTextBlock()),
("image", wagtail.wagtailimages.blocks.ImageChooserBlock()),
(
"iframe",
wagtail.wagtailcore.blocks.StructBlock(
(
(
"url",
wagtail.wagtailcore.blocks.URLBlock(
"Adresse de la page"
),
),
(
"height",
wagtail.wagtailcore.blocks.CharBlock(
"Hauteur (en pixels)"
),
),
)
),
),
)
),
),
migrations.AlterField(
model_name="cofpage",
name="body_en",
field=wagtail.wagtailcore.fields.StreamField(
(
(
"heading",
wagtail.wagtailcore.blocks.CharBlock(classname="full title"),
),
("paragraph", wagtail.wagtailcore.blocks.RichTextBlock()),
("image", wagtail.wagtailimages.blocks.ImageChooserBlock()),
(
"iframe",
wagtail.wagtailcore.blocks.StructBlock(
(
(
"url",
wagtail.wagtailcore.blocks.URLBlock(
"Adresse de la page"
),
),
(
"height",
wagtail.wagtailcore.blocks.CharBlock(
"Hauteur (en pixels)"
),
),
)
),
),
),
null=True,
),
),
migrations.AlterField(
model_name="cofpage",
name="body_fr",
field=wagtail.wagtailcore.fields.StreamField(
(
(
"heading",
wagtail.wagtailcore.blocks.CharBlock(classname="full title"),
),
("paragraph", wagtail.wagtailcore.blocks.RichTextBlock()),
("image", wagtail.wagtailimages.blocks.ImageChooserBlock()),
(
"iframe",
wagtail.wagtailcore.blocks.StructBlock(
(
(
"url",
wagtail.wagtailcore.blocks.URLBlock(
"Adresse de la page"
),
),
(
"height",
wagtail.wagtailcore.blocks.CharBlock(
"Hauteur (en pixels)"
),
),
)
),
),
),
null=True,
),
),
]

View file

@ -1,12 +1,12 @@
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models from django.db import models
from wagtail.contrib.wagtailroutablepage.models import RoutablePageMixin, route from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel from wagtail.contrib.routable_page.models import RoutablePageMixin, route
from wagtail.wagtailcore import blocks from wagtail.core import blocks
from wagtail.wagtailcore.fields import RichTextField, StreamField from wagtail.core.fields import RichTextField, StreamField
from wagtail.wagtailcore.models import Page from wagtail.core.models import Page
from wagtail.wagtailimages.blocks import ImageChooserBlock from wagtail.images.blocks import ImageChooserBlock
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.images.edit_handlers import ImageChooserPanel
# Page pouvant afficher des actualités # Page pouvant afficher des actualités
@ -18,19 +18,26 @@ class COFActuIndexMixin:
# Racine du site du COF # Racine du site du COF
class COFRootPage(Page, COFActuIndexMixin): class COFRootPage(RoutablePageMixin, Page, COFActuIndexMixin):
introduction = RichTextField("Introduction") introduction = RichTextField("Introduction")
content_panels = Page.content_panels + [ content_panels = Page.content_panels + [
FieldPanel("introduction", classname="full") FieldPanel("introduction", classname="full")
] ]
subpage_types = ["COFActuIndexPage", "COFPage", "COFDirectoryPage", "COFUtilPage"] subpage_types = ["COFActuIndexPage", "COFPage", "COFDirectoryPage"]
class Meta: class Meta:
verbose_name = "Racine site du COF" verbose_name = "Racine site du COF"
verbose_name_plural = "Racines site du COF" verbose_name_plural = "Racines site du COF"
# Mini calendrier
@route(r"^calendar/(\d+)/(\d+)/$")
def calendar(self, request, year, month):
from .views import raw_calendar_view
return raw_calendar_view(request, int(year), int(month))
# Block iframe # Block iframe
class IFrameBlock(blocks.StructBlock): class IFrameBlock(blocks.StructBlock):
@ -199,36 +206,3 @@ class COFDirectoryEntryPage(Page):
class Meta: class Meta:
verbose_name = "Entrée d'annuaire" verbose_name = "Entrée d'annuaire"
verbose_name_plural = "Entrées d'annuaire" verbose_name_plural = "Entrées d'annuaire"
# Pour le calendrier, ne doit pas être pris par ModelTranslation
class COFUtilPage(RoutablePageMixin, Page):
# Mini calendrier
@route(r"^calendar/(\d+)/(\d+)/$")
def calendar(self, request, year, month):
from .views import raw_calendar_view
return raw_calendar_view(request, int(year), int(month))
"""
ModelTranslation override le système des @route de wagtail, ce qui empêche
COFUtilPage d'être une page traduite pour pouvoir l'utiliser.
Ce qui fait planter `get_absolute_url` pour des problèmes d'héritage des
pages parentes (qui sont, elles, traduites).
Le seul moyen trouvé pour résoudre ce problème est de faire une autre
fonction à qui on fournit request en argument (donc pas un override de
get_absolute_url).
TODO : vérifier si ces problèmes ont été résolus dans les màj de wagtail
et modeltranslation
"""
def debugged_get_url(self, request):
parent = COFRootPage.objects.parent_of(self).live().first()
burl = parent.relative_url(request.site)
return burl + self.slug
class Meta:
verbose_name = "Page utilitaire"
verbose_name_plural = "Pages utilitaires"

View file

@ -3,8 +3,8 @@
{% for item in menu_items %} {% for item in menu_items %}
<li class="{{ item.active_class }}"> <li class="{{ item.active_class }}">
{% if item.link_page %} {% if item.link_page %}
<a href="{% pageurl item.link_page.specific %}"> <a href="{% pageurl item.link_page %}">
{{ item.link_page.specific.title }} {{ item.link_page.title }}
</a> </a>
{% else %} {% else %}
<a href="{{ item.href }}"> <a href="{{ item.href }}">

View file

@ -4,7 +4,7 @@ from django import template
from django.utils import formats, timezone from django.utils import formats, timezone
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from ..models import COFActuPage, COFUtilPage from ..models import COFActuPage, COFRootPage
register = template.Library() register = template.Library()
@ -71,11 +71,11 @@ def calendar(context, month=None, year=None):
# Calendar next/prev urls # Calendar next/prev urls
try: try:
utilpage = COFUtilPage.objects.live()[0] utilpage = COFRootPage.objects.live()[0]
except COFUtilPage.DoesNotExist: except COFRootPage.DoesNotExist:
utilpage = None utilpage = None
request = context["request"] request = context["request"]
burl = utilpage.debugged_get_url(request) + "/" burl = utilpage.get_url(request)
prev_url = burl + utilpage.reverse_subpage( prev_url = burl + utilpage.reverse_subpage(
"calendar", args=[str(prev_month.year), str(prev_month.month)] "calendar", args=[str(prev_month.year), str(prev_month.month)]
) )

View file

@ -1,5 +1,5 @@
from modeltranslation.decorators import register from modeltranslation.decorators import register
from wagtail_modeltranslation.translator import WagtailTranslationOptions from modeltranslation.translator import TranslationOptions
from .models import ( from .models import (
COFActuIndexPage, COFActuIndexPage,
@ -12,30 +12,30 @@ from .models import (
@register(COFRootPage) @register(COFRootPage)
class COFRootPageTr(WagtailTranslationOptions): class COFRootPageTr(TranslationOptions):
fields = ("introduction",) fields = ("introduction",)
@register(COFPage) @register(COFPage)
class COFPageTr(WagtailTranslationOptions): class COFPageTr(TranslationOptions):
fields = ("body",) fields = ("body",)
@register(COFActuIndexPage) @register(COFActuIndexPage)
class COFActuIndexPageTr(WagtailTranslationOptions): class COFActuIndexPageTr(TranslationOptions):
fields = () fields = ()
@register(COFActuPage) @register(COFActuPage)
class COFActuPageTr(WagtailTranslationOptions): class COFActuPageTr(TranslationOptions):
fields = ("chapo", "body") fields = ("chapo", "body")
@register(COFDirectoryPage) @register(COFDirectoryPage)
class COFDirectoryPageTr(WagtailTranslationOptions): class COFDirectoryPageTr(TranslationOptions):
fields = ("introduction",) fields = ("introduction",)
@register(COFDirectoryEntryPage) @register(COFDirectoryEntryPage)
class COFDirectoryEntryPageTr(WagtailTranslationOptions): class COFDirectoryEntryPageTr(TranslationOptions):
fields = ("body", "links") fields = ("body", "links")

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,6 +1,6 @@
from django.contrib.staticfiles.templatetags.staticfiles import static from django.contrib.staticfiles.templatetags.staticfiles import static
from django.utils.html import format_html from django.utils.html import format_html
from wagtail.wagtailcore import hooks from wagtail.core import hooks
@hooks.register("insert_editor_css") @hooks.register("insert_editor_css")

View file

@ -1,14 +1,14 @@
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.core.management import call_command from django.core.management import call_command
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from wagtail.wagtailcore.models import Page, Site from wagtail.core.models import Page, Site
class Command(BaseCommand): class Command(BaseCommand):
help = "Importe des données pour Wagtail" help = "Importe des données pour Wagtail"
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument("--file", default="kfet_wagtail_17_05") parser.add_argument("--file", default="kfet_wagtail_02_19")
def handle(self, *args, **options): def handle(self, *args, **options):
@ -20,9 +20,11 @@ class Command(BaseCommand):
Group.objects.filter(name__in=("Moderators", "Editors")).delete() Group.objects.filter(name__in=("Moderators", "Editors")).delete()
try: try:
homepage = Page.objects.get(title="Welcome to your new Wagtail site!") homepage = Page.objects.get(pk=2)
homepage.delete() print("home page", homepage.title)
Site.objects.filter(root_page=homepage).delete() if "Welcome" in homepage.title and "Wagtail" in homepage.title:
homepage.delete()
Site.objects.filter(root_page=homepage).delete()
except Page.DoesNotExist: except Page.DoesNotExist:
pass pass

View file

@ -2,9 +2,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import django.db.models.deletion import django.db.models.deletion
import wagtail.wagtailcore.blocks import wagtail.core.blocks
import wagtail.wagtailcore.fields import wagtail.core.fields
import wagtail.wagtailsnippets.blocks import wagtail.snippets.blocks
from django.db import migrations, models from django.db import migrations, models
import kfet.cms.models import kfet.cms.models
@ -36,37 +36,35 @@ class Migration(migrations.Migration):
"no_header", "no_header",
models.BooleanField( models.BooleanField(
verbose_name="Sans en-tête", verbose_name="Sans en-tête",
help_text="Coché, l'en-tête (avec le titre) de la page n'est pas affiché.", help_text="Coché, l'en-tête (avec le titre) de la page n'est pas affiché.", # noqa
default=False, default=False,
), ),
), ),
( (
"content", "content",
wagtail.wagtailcore.fields.StreamField( wagtail.core.fields.StreamField(
( (
( (
"rich", "rich",
wagtail.wagtailcore.blocks.RichTextBlock( wagtail.core.blocks.RichTextBlock(label="Éditeur"),
label="Éditeur"
),
), ),
("carte", kfet.cms.models.MenuBlock()), ("carte", kfet.cms.models.MenuBlock()),
( (
"group_team", "group_team",
wagtail.wagtailcore.blocks.StructBlock( wagtail.core.blocks.StructBlock(
( (
( (
"show_only", "show_only",
wagtail.wagtailcore.blocks.IntegerBlock( wagtail.core.blocks.IntegerBlock(
help_text="Nombre initial de membres affichés. Laisser vide pour tou-te-s les afficher.", help_text="Nombre initial de membres affichés. Laisser vide pour tou-te-s les afficher.", # noqa
required=False, required=False,
label="Montrer seulement", label="Montrer seulement",
), ),
), ),
( (
"members", "members",
wagtail.wagtailcore.blocks.ListBlock( wagtail.core.blocks.ListBlock(
wagtail.wagtailsnippets.blocks.SnippetChooserBlock( wagtail.snippets.blocks.SnippetChooserBlock( # noqa
kfet.cms.models.MemberTeam kfet.cms.models.MemberTeam
), ),
classname="team-group", classname="team-group",
@ -78,32 +76,32 @@ class Migration(migrations.Migration):
), ),
( (
"group", "group",
wagtail.wagtailcore.blocks.StreamBlock( wagtail.core.blocks.StreamBlock(
( (
( (
"rich", "rich",
wagtail.wagtailcore.blocks.RichTextBlock( wagtail.core.blocks.RichTextBlock(
label="Éditeur" label="Éditeur"
), ),
), ),
("carte", kfet.cms.models.MenuBlock()), ("carte", kfet.cms.models.MenuBlock()),
( (
"group_team", "group_team",
wagtail.wagtailcore.blocks.StructBlock( wagtail.core.blocks.StructBlock(
( (
( (
"show_only", "show_only",
wagtail.wagtailcore.blocks.IntegerBlock( wagtail.core.blocks.IntegerBlock( # noqa
help_text="Nombre initial de membres affichés. Laisser vide pour tou-te-s les afficher.", help_text="Nombre initial de membres affichés. Laisser vide pour tou-te-s les afficher.", # noqa
required=False, required=False,
label="Montrer seulement", label="Montrer seulement",
), ),
), ),
( (
"members", "members",
wagtail.wagtailcore.blocks.ListBlock( wagtail.core.blocks.ListBlock(
wagtail.wagtailsnippets.blocks.SnippetChooserBlock( wagtail.snippets.blocks.SnippetChooserBlock( # noqa
kfet.cms.models.MemberTeam kfet.cms.models.MemberTeam # noqa
), ),
classname="team-group", classname="team-group",
label="K-Fêt-eux-ses", label="K-Fêt-eux-ses",
@ -157,7 +155,7 @@ class Migration(migrations.Migration):
max_length=255, max_length=255,
blank=True, blank=True,
verbose_name="Nombre de colonnes", verbose_name="Nombre de colonnes",
help_text="S'applique au page dont le contenu est scindé sur plusieurs colonnes", help_text="S'applique au page dont le contenu est scindé sur plusieurs colonnes", # noqa
), ),
), ),
], ],

View file

@ -1,17 +1,17 @@
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin.edit_handlers import ( from wagtail.admin.edit_handlers import (
FieldPanel, FieldPanel,
FieldRowPanel, FieldRowPanel,
MultiFieldPanel, MultiFieldPanel,
StreamFieldPanel, StreamFieldPanel,
) )
from wagtail.wagtailcore import blocks from wagtail.core import blocks
from wagtail.wagtailcore.fields import StreamField from wagtail.core.fields import StreamField
from wagtail.wagtailcore.models import Page from wagtail.core.models import Page
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.wagtailsnippets.blocks import SnippetChooserBlock from wagtail.snippets.blocks import SnippetChooserBlock
from wagtail.wagtailsnippets.models import register_snippet from wagtail.snippets.models import register_snippet
from kfet.cms.context_processors import get_articles from kfet.cms.context_processors import get_articles

9
kfet/cms/translation.py Normal file
View file

@ -0,0 +1,9 @@
from modeltranslation.decorators import register
from modeltranslation.translator import TranslationOptions
from .models import KFetPage
@register(KFetPage)
class KFetPageTr(TranslationOptions):
fields = []

View file

@ -4,6 +4,8 @@
set -e set -e
python manage.py migrate python manage.py migrate
python manage.py sync_page_translation_fields
python manage.py update_translation_fields
python manage.py loaddata gestion sites articles python manage.py loaddata gestion sites articles
python manage.py loaddevdata python manage.py loaddevdata
python manage.py syncmails gestioncof/management/data/custommail.json python manage.py syncmails gestioncof/management/data/custommail.json

View file

@ -20,9 +20,9 @@ git+https://git.eleves.ens.fr/cof-geek/django_custommail.git#egg=django_customma
ldap3 ldap3
channels==1.1.5 channels==1.1.5
python-dateutil python-dateutil
wagtail==1.11.* wagtail==2.3.*
wagtailmenus==2.2.* wagtailmenus==2.12.*
wagtail-modeltranslation==0.6.0rc2 wagtail-modeltranslation==0.9.*
django-cors-headers==2.2.0 django-cors-headers==2.2.0
# Production tools # Production tools