1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
wagtail-website-2018-spike/project/common/models.py

33 lines
955 B
Python

from wagtail.core.models import Page
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtailmetadata.models import MetadataPageMixin
class Entity(MetadataPageMixin, Page):
is_home = False
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
post_date = models.DateTimeField(null=True, blank=True)
promote_panels = [
MultiFieldPanel([
FieldPanel('slug'),
FieldPanel('seo_title'),
FieldPanel('post_date'),
FieldPanel('search_description'),
ImageChooserPanel('search_image'),
], 'Common page configuration'),
]
@property
def image(self):
return self.search_image
def get_meta_description(self):
return self.search_description
class Meta:
abstract = True