# Path: pages/models.py
# class TexteDAccueil(Page):
#     texte_accueil = fields.RichTextField()
#     parent_page_types = []  # Don't let users create other home pages
#     content_panels = Page.content_panels + [
#         edit_handlers.FieldPanel('texte_accueil', classname="full"),
#     ]


from django.db import migrations
from ..models import TexteDAccueil
from wagtail.core.models import Site, Page
from django.contrib.contenttypes.models import ContentType
# Generated by Django 3.2.6 on 2021-08-26 10:45



def create_texte_d_accueil(apps, schema_editor):
    texte_accueil = '''<h2 data-block-key="tddr5">Bienvenue</h2><p data-block-key="d6kqb">Customiser le texte d&#x27;accueil dans « administrer / Gestion du contenu rédactionnel / Pages »</p>'''
    texte_page = TexteDAccueil(
        title="Texte d'accueil",
        texte_accueil=texte_accueil,
        content_type=ContentType.objects.get(app_label="pages", model="textedaccueil"),
    )
    # root = Site.objects.get(is_default_site=True).root_page
    root = Page.get_first_root_node()
    root.add_child(instance=texte_page)


def delete_texte_d_accueil(apps, schema_editor):

# Path: pages/models.py
# class TexteDAccueil(Page):
#     texte_accueil = fields.RichTextField()
#     parent_page_types = []  # Don't let users create other home pages
#     content_panels = Page.content_panels + [
#         edit_handlers.FieldPanel('texte_accueil', classname="full"),
#     ]


# Path: pages/migrations/0002_texte_d_accueil.py
from django.db import migrations
from ..models import TexteDAccueil
from wagtail.core.models import Site, Page
from django.contrib.contenttypes.models import ContentType

# Generated by Django 3.2.6 on 2021-08-26 10:45



def create_texte_d_accueil(apps, schema_editor):
    texte_accueil = '''<h2 data-block-key="tddr5">Bienvenue</h2><p data-block-key="d6kqb">Customiser le texte d&#x27;accueil dans « administrer / Gestion du contenu rédactionnel / Pages »</p>'''
    texte_page = TexteDAccueil(
        title="Texte d'accueil",
        texte_accueil=texte_accueil,
        content_type=ContentType.objects.get(app_label="pages", model="textedaccueil"),
    )
    # root = Site.objects.get(is_default_site=True).root_page
    root = Page.get_first_root_node()
    root.add_child(instance=texte_page)


def delete_texte_d_accueil(apps, schema_editor):

    TexteDAccueil.objects.all().delete()