Clean, lint and fix little things
This commit is contained in:
parent
f105225abf
commit
376cc96343
9 changed files with 62 additions and 63 deletions
|
@ -135,4 +135,5 @@ if settings.DEBUG:
|
|||
# Wagtail for uncatched
|
||||
urlpatterns += i18n_patterns(
|
||||
url(r'', include(wagtail_urls)),
|
||||
prefix_default_language=False
|
||||
)
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
|
@ -1084,7 +1084,6 @@
|
|||
"seo_title_en": null,
|
||||
"search_description_fr": "",
|
||||
"search_description_en": "",
|
||||
"sort_order": null,
|
||||
"body": "Le club Arts Plastiques te propose un lieu de rencontre entre \npersonnes int\u00e9ress\u00e9es par les arts plastiques, le dessin ou la peinture.<br/>\nMais, que faisons-nous au club Arts Plastiques ? D\u2019abord, des s\u00e9ances \nd\u2019initiation; et puis des s\u00e9ances \u00e0 th\u00e8me, avec des intervenants; des \nprojets communs; des sorties croquis\u2026<br/><p>\nQue tu n\u2019aies jamais touch\u00e9 \u00e0 un pinceau, ou que tu sois d\u00e9j\u00e0 un-e grand-e artiste, n\u2019h\u00e9site pas \u00e0 venir nous rejoindre !<strong></strong></p>",
|
||||
"body_fr": "Le club Arts Plastiques te propose un lieu de rencontre entre \npersonnes int\u00e9ress\u00e9es par les arts plastiques, le dessin ou la peinture.<br/>\nMais, que faisons-nous au club Arts Plastiques ? D\u2019abord, des s\u00e9ances \nd\u2019initiation; et puis des s\u00e9ances \u00e0 th\u00e8me, avec des intervenants; des \nprojets communs; des sorties croquis\u2026<br/><p>\nQue tu n\u2019aies jamais touch\u00e9 \u00e0 un pinceau, ou que tu sois d\u00e9j\u00e0 un-e grand-e artiste, n\u2019h\u00e9site pas \u00e0 venir nous rejoindre !<strong></strong></p>",
|
||||
"body_en": "",
|
||||
|
@ -1108,7 +1107,6 @@
|
|||
"seo_title_en": null,
|
||||
"search_description_fr": "",
|
||||
"search_description_en": "",
|
||||
"sort_order": null,
|
||||
"body": "De Riad Sattouf \u00e0 Katsuhiro Otomo, en passant par Andr\u00e9 Franquin, \nJacques Tardi, Didier Tarquin et Georges Wolinski, la BDth\u00e8que poss\u00e8de \nune collection de quatre mille bandes dessin\u00e9es sur une cinquantaine \nd\u2019\u00e9tag\u00e8res, en constante croissance. Class\u00e9es par dessinateur et \ncatalogu\u00e9es, toutes ces oeuvres offrent un large panorama du XXe si\u00e8cle \net sont librement consultables sur place sans mod\u00e9ration ! \u00c0 cela \ns\u2019ajoutent des milliers de p\u00e9riodiques sp\u00e9cialis\u00e9s datant de l\u2019\u00e2ge d\u2019or \nde la BD franco-belge, un Enfer cach\u00e9, et quelques conseils de lecture \n\u00e9crits par des fans.<br/><p>\nLe club organise ausis des \u00e9v\u00e9nements divers par exemple un s\u00e9minaire \nsur la bande dessin\u00e9e, qui ne demande qu\u2019\u00e0 \u00eatre relanc\u00e9. \u00c0 l\u2019ordre du \njour, la mise en place d\u2019une exp\u00e9dition \u00e0 Angoul\u00eame avec le BDA en \njanvier 2017 pourrait m\u00eame se faire avec ton aide. Tous les \ndons et suggestions d\u2019achats sont les bienvenus. Pour participer aux \nd\u00e9cisions d\u2019achats, \u00e9crire des suggesions de lecture dans le BOcal, \nchoisir les bandes dessin\u00e9es \u00e0 mettre en valeur, n\u2019h\u00e9site pas \u00e0 \nrejoindre le club!</p>",
|
||||
"body_fr": "De Riad Sattouf \u00e0 Katsuhiro Otomo, en passant par Andr\u00e9 Franquin, \nJacques Tardi, Didier Tarquin et Georges Wolinski, la BDth\u00e8que poss\u00e8de \nune collection de quatre mille bandes dessin\u00e9es sur une cinquantaine \nd\u2019\u00e9tag\u00e8res, en constante croissance. Class\u00e9es par dessinateur et \ncatalogu\u00e9es, toutes ces oeuvres offrent un large panorama du XXe si\u00e8cle \net sont librement consultables sur place sans mod\u00e9ration ! \u00c0 cela \ns\u2019ajoutent des milliers de p\u00e9riodiques sp\u00e9cialis\u00e9s datant de l\u2019\u00e2ge d\u2019or \nde la BD franco-belge, un Enfer cach\u00e9, et quelques conseils de lecture \n\u00e9crits par des fans.<br/><p>\nLe club organise ausis des \u00e9v\u00e9nements divers par exemple un s\u00e9minaire \nsur la bande dessin\u00e9e, qui ne demande qu\u2019\u00e0 \u00eatre relanc\u00e9. \u00c0 l\u2019ordre du \njour, la mise en place d\u2019une exp\u00e9dition \u00e0 Angoul\u00eame avec le BDA en \njanvier 2017 pourrait m\u00eame se faire avec ton aide. Tous les \ndons et suggestions d\u2019achats sont les bienvenus. Pour participer aux \nd\u00e9cisions d\u2019achats, \u00e9crire des suggesions de lecture dans le BOcal, \nchoisir les bandes dessin\u00e9es \u00e0 mettre en valeur, n\u2019h\u00e9site pas \u00e0 \nrejoindre le club!</p>",
|
||||
"body_en": "",
|
||||
|
@ -1132,7 +1130,6 @@
|
|||
"seo_title_en": null,
|
||||
"search_description_fr": "",
|
||||
"search_description_en": "",
|
||||
"sort_order": null,
|
||||
"body": "<p>La <a href=\"https://www.mgen.fr/accueil/\">MGEN</a> est un des \nprincipaux partenaires du COF. Elle\u00a0participe au financement des \nprincipaux \u00e9v\u00e9nements (Jour le plus court, 48h des Arts) et \u00e0 \nl\u2019impression de la Plakette Alpha.</p>\n<p>Elle dispose \u00e9galement d\u2019un stand chaque ann\u00e9e au moment de la \nrentr\u00e9e, afin de proposer ses prestations aux pensionnaires de l\u2019Ecole.</p>",
|
||||
"body_fr": "<p>La <a href=\"https://www.mgen.fr/accueil/\">MGEN</a> est un des \nprincipaux partenaires du COF. Elle\u00a0participe au financement des \nprincipaux \u00e9v\u00e9nements (Jour le plus court, 48h des Arts) et \u00e0 \nl\u2019impression de la Plakette Alpha.</p>\n<p>Elle dispose \u00e9galement d\u2019un stand chaque ann\u00e9e au moment de la \nrentr\u00e9e, afin de proposer ses prestations aux pensionnaires de l\u2019Ecole.</p>",
|
||||
"body_en": "",
|
||||
|
@ -1156,7 +1153,6 @@
|
|||
"seo_title_en": null,
|
||||
"search_description_fr": "",
|
||||
"search_description_en": "",
|
||||
"sort_order": null,
|
||||
"body": "<p>Si vous ouvrez un compte \u00e0 la SoG\u00e9, ils vous versent 140\u20ac et versent \naussi une somme au bureau, nous permettant de financer vos clubs et \n\u00e9v\u00e8nements. Vous pouvez donc rembourser votre cotisation au COF (voire \nplus) rien qu\u2019en ouvrant un compte !</p>\n<p>Vous devez ouvrir ce compte lors des journ\u00e9es de rentr\u00e9e, lorsque la \nSoG\u00e9 a un stand \u00e0 l\u2019Ecole, ou toute l\u2019ann\u00e9e \u00e0 leur agence au 38 rue \nGay-Lussac.</p>",
|
||||
"body_fr": "<p>Si vous ouvrez un compte \u00e0 la SoG\u00e9, ils vous versent 140\u20ac et versent \naussi une somme au bureau, nous permettant de financer vos clubs et \n\u00e9v\u00e8nements. Vous pouvez donc rembourser votre cotisation au COF (voire \nplus) rien qu\u2019en ouvrant un compte !</p>\n<p>Vous devez ouvrir ce compte lors des journ\u00e9es de rentr\u00e9e, lorsque la \nSoG\u00e9 a un stand \u00e0 l\u2019Ecole, ou toute l\u2019ann\u00e9e \u00e0 leur agence au 38 rue \nGay-Lussac.</p>",
|
||||
"body_en": "",
|
||||
|
@ -1180,7 +1176,6 @@
|
|||
"seo_title_en": null,
|
||||
"search_description_fr": "",
|
||||
"search_description_en": "",
|
||||
"sort_order": null,
|
||||
"body": "<p>La <a href=\"http://www.maif.fr/accueil.html\">Maif</a>\u00a0est un partenaire important du COF, et participe notamment au financement de la Plakette.</p>\n<p>Elle est aussi pr\u00e9sente \u00e0 chaque rentr\u00e9e pour proposer ses services sous la forme d\u2019un stand d\u2019information.</p>",
|
||||
"body_fr": "<p>La <a href=\"http://www.maif.fr/accueil.html\">Maif</a>\u00a0est un partenaire important du COF, et participe notamment au financement de la Plakette.</p>\n<p>Elle est aussi pr\u00e9sente \u00e0 chaque rentr\u00e9e pour proposer ses services sous la forme d\u2019un stand d\u2019information.</p>",
|
||||
"body_en": "",
|
||||
|
|
|
@ -33,11 +33,6 @@ class Migration(migrations.Migration):
|
|||
name='cofdirectoryentrypage',
|
||||
options={'verbose_name': "Entrée d'annuaire", 'verbose_name_plural': "Entrées d'annuaire"},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cofdirectoryentrypage',
|
||||
name='sort_order',
|
||||
field=models.IntegerField(blank=True, editable=False, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cofdirectorypage',
|
||||
name='alphabetique',
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
|
||||
from django.db import models
|
||||
|
||||
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from wagtail.contrib.wagtailroutablepage.models import RoutablePageMixin, route
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel
|
||||
from wagtail.wagtailcore import blocks
|
||||
from wagtail.wagtailcore.fields import RichTextField, StreamField
|
||||
from wagtail.wagtailcore.models import Page, Orderable
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailimages.blocks import ImageChooserBlock
|
||||
from wagtail.wagtailsnippets.models import register_snippet
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
|
||||
|
||||
# Page pouvant afficher des actualités
|
||||
class COFActuIndexMixin:
|
||||
|
@ -19,7 +15,8 @@ class COFActuIndexMixin:
|
|||
def actus(self):
|
||||
actus = COFActuPage.objects.live().order_by('-date_start').descendant_of(self)
|
||||
return actus
|
||||
|
||||
|
||||
|
||||
# Racine du site du COF
|
||||
class COFRootPage(Page, COFActuIndexMixin):
|
||||
introduction = RichTextField("Introduction")
|
||||
|
@ -27,13 +24,14 @@ class COFRootPage(Page, COFActuIndexMixin):
|
|||
content_panels = Page.content_panels + [
|
||||
FieldPanel('introduction', classname="full"),
|
||||
]
|
||||
|
||||
|
||||
subpage_types = ['COFActuIndexPage', 'COFPage', 'COFDirectoryPage', 'COFUtilPage']
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Racine site du COF"
|
||||
verbose_name_plural = "Racines site du COF"
|
||||
|
||||
|
||||
# Block iframe
|
||||
class IFrameBlock(blocks.StructBlock):
|
||||
url = blocks.URLBlock("Adresse de la page")
|
||||
|
@ -43,7 +41,8 @@ class IFrameBlock(blocks.StructBlock):
|
|||
verbose_name = "Page incluse (iframe, à utiliser avec précaution)"
|
||||
verbose_name_plural = "Pages incluses (iframes, à utiliser avec précaution)"
|
||||
template = "cofcms/iframe_block.html"
|
||||
|
||||
|
||||
|
||||
# Page lambda du site
|
||||
class COFPage(Page):
|
||||
body = StreamField([
|
||||
|
@ -56,7 +55,7 @@ class COFPage(Page):
|
|||
content_panels = Page.content_panels + [
|
||||
StreamFieldPanel('body'),
|
||||
]
|
||||
|
||||
|
||||
subpage_types = ['COFDirectoryPage', 'COFPage']
|
||||
parent_page_types = ['COFPage', 'COFRootPage']
|
||||
|
||||
|
@ -64,11 +63,12 @@ class COFPage(Page):
|
|||
verbose_name = "Page normale COF"
|
||||
verbose_name_plural = "Pages normales COF"
|
||||
|
||||
|
||||
# Actualités
|
||||
class COFActuIndexPage(Page, COFActuIndexMixin):
|
||||
subpage_types = ['COFActuPage']
|
||||
parent_page_types = ['COFRootPage']
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Index des actualités"
|
||||
verbose_name_plural = "Indexs des actualités"
|
||||
|
@ -89,6 +89,7 @@ class COFActuIndexPage(Page, COFActuIndexMixin):
|
|||
context['actus'] = actus
|
||||
return context
|
||||
|
||||
|
||||
class COFActuPage(RoutablePageMixin, Page):
|
||||
chapo = models.TextField("Description rapide", blank=True)
|
||||
body = RichTextField("Contenu")
|
||||
|
@ -97,12 +98,12 @@ class COFActuPage(RoutablePageMixin, Page):
|
|||
null=True, blank=True,
|
||||
on_delete=models.SET_NULL, related_name='+'
|
||||
)
|
||||
is_event = models.BooleanField("Évènement", default=True, blank=True)
|
||||
is_event = models.BooleanField("Évènement", default=True, blank=True)
|
||||
date_start = models.DateTimeField("Date et heure de début")
|
||||
date_end = models.DateTimeField("Date et heure de fin", blank=True, default=None, null=True)
|
||||
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'),
|
||||
|
@ -119,13 +120,14 @@ class COFActuPage(RoutablePageMixin, Page):
|
|||
class Meta:
|
||||
verbose_name = "Actualité"
|
||||
verbose_name_plural = "Actualités"
|
||||
|
||||
|
||||
|
||||
# Annuaires (Clubs, partenaires, bonnes adresses)
|
||||
class COFDirectoryPage(Page):
|
||||
introduction = RichTextField("Introduction")
|
||||
alphabetique = models.BooleanField("Tri par ordre alphabétique ?",
|
||||
default=True, blank=True)
|
||||
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel('introduction'),
|
||||
FieldPanel('alphabetique'),
|
||||
|
@ -147,7 +149,7 @@ class COFDirectoryPage(Page):
|
|||
verbose_name_plural = "Annuaires"
|
||||
|
||||
|
||||
class COFDirectoryEntryPage(Page, Orderable):
|
||||
class COFDirectoryEntryPage(Page):
|
||||
body = RichTextField("Description")
|
||||
links = StreamField([
|
||||
('lien', blocks.StructBlock([
|
||||
|
@ -179,9 +181,10 @@ class COFDirectoryEntryPage(Page, Orderable):
|
|||
verbose_name = "Entrée 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):
|
||||
|
@ -204,7 +207,7 @@ class COFUtilPage(RoutablePageMixin, Page):
|
|||
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"
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
from datetime import timedelta, date
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
from django.utils import timezone, formats
|
||||
import locale
|
||||
from datetime import date, timedelta
|
||||
|
||||
from django import template
|
||||
from django.utils import formats, timezone
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from ..models import COFActuPage, COFUtilPage
|
||||
|
||||
import re
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.filter()
|
||||
def obfuscate_mail(value):
|
||||
val = value.replace('', '-').replace('@', 'arbre').replace('.', 'pont')[1:]
|
||||
return val
|
||||
|
||||
|
||||
@register.inclusion_tag("cofcms/calendar.html", takes_context=True)
|
||||
def calendar(context, month=None, year=None):
|
||||
now = timezone.now()
|
||||
|
@ -28,7 +26,7 @@ def calendar(context, month=None, year=None):
|
|||
next_month = date(next_month.year, next_month.month, 1)
|
||||
prev_month = month_start - timedelta(days=2)
|
||||
month_prestart = month_start - timedelta(days=month_start.weekday())
|
||||
month_postend = next_month + timedelta(days=(next_month.weekday()+6)%7)
|
||||
month_postend = next_month + timedelta(days=(next_month.weekday() + 6) % 7)
|
||||
events = COFActuPage.objects.live()\
|
||||
.filter(date_start__range=[month_prestart,
|
||||
month_postend],
|
||||
|
@ -38,13 +36,14 @@ def calendar(context, month=None, year=None):
|
|||
weeks = []
|
||||
curday = month_prestart
|
||||
deltaday = timedelta(days=1)
|
||||
while curday < next_month and len(weeks)<10:
|
||||
while curday < next_month and len(weeks) < 10:
|
||||
week = []
|
||||
for k in range(7):
|
||||
curevents = []
|
||||
for k in range(len(events)-1, -1, -1):
|
||||
for k in range(len(events) - 1, -1, -1):
|
||||
e = events[k]
|
||||
if e.date_start.date() > curday: break
|
||||
if e.date_start.date() > curday:
|
||||
break
|
||||
if (e.date_start if e.date_end is None else e.date_end).date() < curday:
|
||||
del events[k]
|
||||
else:
|
||||
|
@ -61,7 +60,6 @@ def calendar(context, month=None, year=None):
|
|||
curday += deltaday
|
||||
weeks.append(week)
|
||||
|
||||
|
||||
# Calendar next/prev urls
|
||||
try:
|
||||
utilpage = COFUtilPage.objects.live()[0]
|
||||
|
@ -79,6 +77,7 @@ def calendar(context, month=None, year=None):
|
|||
"prev_month": prev_url, "next_month": next_url})
|
||||
return context
|
||||
|
||||
|
||||
@register.inclusion_tag("cofcms/mini_calendar.html")
|
||||
def mini_calendar(event):
|
||||
days = []
|
||||
|
@ -99,14 +98,14 @@ def mini_calendar(event):
|
|||
def dates(event):
|
||||
def factorize_suffix(a, b):
|
||||
i = -1
|
||||
imin = -min(len(a), len(b))
|
||||
while i>imin and a[i] == b[i]:
|
||||
imin = - min(len(a), len(b))
|
||||
while i > imin and a[i] == b[i]:
|
||||
i -= 1
|
||||
if i == -1:
|
||||
return (a, b, '')
|
||||
else:
|
||||
return (a[:i+1], b[:i+1], a[i+1:])
|
||||
|
||||
return (a[:i + 1], b[:i + 1], a[i + 1:])
|
||||
|
||||
datestart_string = formats.date_format(event.date_start)
|
||||
timestart_string = formats.time_format(event.date_start)
|
||||
if event.date_end:
|
||||
|
@ -120,7 +119,6 @@ def dates(event):
|
|||
formats.time_format(event.date_end))
|
||||
else:
|
||||
dateend_string = formats.date_format(event.date_end)
|
||||
timeend_string = formats.time_format(event.date_end)
|
||||
diffstart, diffend, common = factorize_suffix(datestart_string,
|
||||
dateend_string)
|
||||
if event.all_day:
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
|
@ -1,25 +1,36 @@
|
|||
from .models import COFRootPage, COFPage, COFActuIndexPage, COFActuPage, COFDirectoryPage, COFDirectoryEntryPage
|
||||
|
||||
from wagtail_modeltranslation.translator import WagtailTranslationOptions
|
||||
from modeltranslation.decorators import register
|
||||
from wagtail_modeltranslation.translator import WagtailTranslationOptions
|
||||
|
||||
from .models import (
|
||||
COFActuIndexPage,
|
||||
COFActuPage,
|
||||
COFDirectoryEntryPage,
|
||||
COFDirectoryPage,
|
||||
COFPage,
|
||||
COFRootPage,
|
||||
)
|
||||
|
||||
|
||||
@register(COFRootPage)
|
||||
class COFPageTr(WagtailTranslationOptions):
|
||||
class COFRootPageTr(WagtailTranslationOptions):
|
||||
fields = (
|
||||
'introduction',
|
||||
)
|
||||
|
||||
|
||||
@register(COFPage)
|
||||
class COFPageTr(WagtailTranslationOptions):
|
||||
fields = (
|
||||
'body',
|
||||
)
|
||||
|
||||
|
||||
@register(COFActuIndexPage)
|
||||
class COFActuIndexPageTr(WagtailTranslationOptions):
|
||||
fields = (
|
||||
)
|
||||
|
||||
|
||||
@register(COFActuPage)
|
||||
class COFActuPageTr(WagtailTranslationOptions):
|
||||
fields = (
|
||||
|
@ -27,12 +38,14 @@ class COFActuPageTr(WagtailTranslationOptions):
|
|||
'body',
|
||||
)
|
||||
|
||||
|
||||
@register(COFDirectoryPage)
|
||||
class COFDirectoryPageTr(WagtailTranslationOptions):
|
||||
fields = (
|
||||
'introduction',
|
||||
)
|
||||
|
||||
|
||||
|
||||
@register(COFDirectoryEntryPage)
|
||||
class COFDirectoryEntryPageTr(WagtailTranslationOptions):
|
||||
fields = (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.shortcuts import render
|
||||
from django.http.response import HttpResponseRedirect
|
||||
import re
|
||||
|
||||
|
||||
def raw_calendar_view(request, year, month):
|
||||
return render(request, "cofcms/calendar_raw.html", {"month": month, "year": year})
|
||||
return render(request, "cofcms/calendar_raw.html",
|
||||
{"month": month, "year": year})
|
||||
|
|
Loading…
Reference in a new issue