import json from django.db import models """ Create or customize your page models here. """ from modelcluster.fields import ParentalKey from coderedcms.forms import CoderedFormField from coderedcms.models import ( CoderedArticlePage, CoderedArticleIndexPage, CoderedEmail, CoderedFormPage, CoderedWebPage, ) #from wagtail.models import PreviewableMixin from wagtail.fields import RichTextField, StreamField from wagtail.admin.panels import FieldPanel, InlinePanel from wagtail.contrib.routable_page.models import ( RoutablePageMixin, path ) from wagtailmedia.edit_handlers import MediaChooserPanel import wagtailmedia.blocks as wtm_blocks from wagtail.snippets.models import register_snippet import wagtail.blocks as wt_blocks import coderedcms.blocks as cr_blocks from django.utils.translation import gettext_lazy as _ from wagtail.admin.widgets.chooser import BaseChooser #from wagtail.admin.widgets import AdminChooser from django import forms from wagtail.admin.staticfiles import versioned_static from generic_chooser.widgets import AdminChooser from generic_chooser.views import ModelChooserViewSet from django.contrib.admin.utils import quote from django.urls import reverse from wagtail.search import index class ArticlePage(CoderedArticlePage): """ Article, suitable for news or blog content. """ class Meta: verbose_name = "Article" ordering = ["-first_published_at"] # Only allow this page to be created beneath an ArticleIndexPage. parent_page_types = ["website.ArticleIndexPage"] template = "coderedcms/pages/article_page.html" search_template = "coderedcms/pages/article_page.search.html" class ArticleIndexPage(CoderedArticleIndexPage): """ Shows a list of article sub-pages. """ class Meta: verbose_name = "Article Landing Page" # Override to specify custom index ordering choice/default. index_query_pagemodel = "website.ArticlePage" # Only allow ArticlePages beneath this page. subpage_types = ["website.ArticlePage"] template = "coderedcms/pages/article_index_page.html" class FormPage(CoderedFormPage): """ A page with an html