feat(projet): ajoute des éléments, reprécise les droits des pages, page accueil unique
Parent
09a16f5af2
révision
a16760d942
|
@ -12,9 +12,22 @@ class ImageEnTete(models.ForeignKey):
|
|||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
class ContenuBloc(blocks.StructBlock):
|
||||
class ContenuTexte(blocks.StructBlock):
|
||||
class Meta:
|
||||
icon = 'openquote'
|
||||
|
||||
titre = blocks.CharBlock(icon='title')
|
||||
|
||||
|
||||
class ContenuMedia(blocks.StructBlock):
|
||||
class Meta:
|
||||
template = 'pepite/blocs/infos.html'
|
||||
icon = 'media'
|
||||
|
||||
titre = blocks.CharBlock(icon='title')
|
||||
|
||||
|
||||
class ContenuBlocs(blocks.StructBlock):
|
||||
class Meta:
|
||||
icon = 'site'
|
||||
|
||||
titre = blocks.CharBlock(icon='title')
|
||||
|
|
|
@ -15,16 +15,21 @@ class SitePage(Page):
|
|||
### Contraintes de structure
|
||||
### ------------------------
|
||||
|
||||
subpage_types = ['SitePage']
|
||||
parent_page_types = ['Espace', 'Accueil', 'SitePage']
|
||||
subpage_types = ['SitePage']
|
||||
|
||||
### Body
|
||||
### ----
|
||||
|
||||
image_en_tete = weo.models.ImageEnTete(blank=True)
|
||||
contenu = StreamField(
|
||||
[('contenu_bloc', weo.models.ContenuBloc())],
|
||||
blank=True)
|
||||
[
|
||||
('texte', weo.models.ContenuTexte()),
|
||||
('media', weo.models.ContenuMedia()),
|
||||
('blocs', weo.models.ContenuBlocs()),
|
||||
],
|
||||
blank=True
|
||||
)
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
ImageChooserPanel('image_en_tete'),
|
||||
|
@ -37,7 +42,12 @@ class SitePage(Page):
|
|||
### Réglages
|
||||
### --------
|
||||
|
||||
|
||||
class Espace(SitePage):
|
||||
|
||||
parent_page_types = ['Espace', 'Accueil', 'SitePage']
|
||||
subpage_types = ['SitePage']
|
||||
|
||||
bling = RichTextField(blank=True)
|
||||
content_panels = SitePage.content_panels + [
|
||||
FieldPanel('bling'),
|
||||
|
@ -45,4 +55,11 @@ class Espace(SitePage):
|
|||
|
||||
|
||||
class Accueil(SitePage):
|
||||
|
||||
parent_page_types = [Page]
|
||||
subpage_types = ['Espace', 'SitePage']
|
||||
|
||||
@classmethod
|
||||
def can_create_at(cls, parent):
|
||||
# Seulement une instance possible
|
||||
return not cls.objects.exists() and super().can_create_at(parent)
|
||||
|
|
Chargement…
Référencer dans un nouveau ticket