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.
28 lines
845 B
28 lines
845 B
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 GaleriePage(Page):
|
|
content_panels = Page.content_panels + [
|
|
InlinePanel('gallery_images', label="Obrázky"),
|
|
]
|
|
|
|
|
|
class GalerieImage(Orderable):
|
|
page = ParentalKey(GaleriePage, on_delete=models.CASCADE, related_name='gallery_images')
|
|
image = models.ForeignKey(
|
|
'wagtailimages.Image', on_delete=models.CASCADE, related_name='+'
|
|
)
|
|
caption = models.CharField(blank=True, max_length=250)
|
|
|
|
panels = [
|
|
ImageChooserPanel('image'),
|
|
FieldPanel('caption'),
|
|
]
|
|
|