You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
53 lines
1.6 KiB
from django.db import models
|
|
|
|
from modelcluster.fields import ParentalKey
|
|
|
|
from wagtail.core.models import Page, Orderable
|
|
from wagtail.core.fields import RichTextField
|
|
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel
|
|
from wagtail.images.edit_handlers import ImageChooserPanel
|
|
from wagtail.search import index
|
|
|
|
|
|
class ProgramList(Page):
|
|
year = models.PositiveIntegerField(blank=True)
|
|
intro = RichTextField(blank=True)
|
|
image = models.ForeignKey(
|
|
'wagtailimages.Image', on_delete=models.CASCADE, related_name='+'
|
|
)
|
|
|
|
parent_page_types = ['home.HomePage', ]
|
|
|
|
content_panels = Page.content_panels + [
|
|
FieldPanel('year'),
|
|
FieldPanel('intro', classname="full"),
|
|
ImageChooserPanel('image'),
|
|
]
|
|
|
|
|
|
class ProgramEntry(Page):
|
|
date = models.DateTimeField("Datum a čas projekce")
|
|
place = models.CharField(max_length=64)
|
|
release_date = models.DateField("Datum vydání filmu")
|
|
director = models.CharField(max_length=64)
|
|
country = models.CharField(max_length=64)
|
|
annotation = RichTextField(blank=True)
|
|
image = models.ForeignKey(
|
|
'wagtailimages.Image', on_delete=models.CASCADE, related_name='+'
|
|
)
|
|
|
|
parent_page_types = ['program.ProgramList', ]
|
|
|
|
search_fields = Page.search_fields + [
|
|
index.SearchField('annotation'),
|
|
]
|
|
|
|
content_panels = Page.content_panels + [
|
|
FieldPanel('date'),
|
|
FieldPanel('place'),
|
|
FieldPanel('release_date'),
|
|
FieldPanel('director'),
|
|
FieldPanel('country'),
|
|
FieldPanel('annotation', classname="full"),
|
|
ImageChooserPanel('image'),
|
|
]
|
|
|