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.
36 lines
1.1 KiB
36 lines
1.1 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 Katalog(Page):
|
|
parent_page_types = ['home.HomePage', ]
|
|
subpage_types = ['Kniha', ]
|
|
|
|
|
|
class Kniha(Page):
|
|
podnadpis = models.CharField(max_length=128, verbose_name='Podnadpis', null=True, blank=True)
|
|
datum_vydani = models.DateField("Datum vydání")
|
|
autor = models.CharField(max_length=128, verbose_name='Autor')
|
|
anotace = RichTextField(blank=True)
|
|
obrazek = models.ForeignKey('wagtailimages.Image', on_delete=models.PROTECT, related_name='+')
|
|
|
|
parent_page_types = ['Katalog', ]
|
|
|
|
search_fields = Page.search_fields + [
|
|
index.SearchField('anotace'),
|
|
]
|
|
|
|
content_panels = Page.content_panels + [
|
|
FieldPanel('podnadpis'),
|
|
FieldPanel('autor'),
|
|
FieldPanel('datum_vydani'),
|
|
FieldPanel('anotace', classname="full"),
|
|
ImageChooserPanel('obrazek'),
|
|
]
|
|
|