4 changed files with 114 additions and 0 deletions
@ -0,0 +1,28 @@ |
|||||
|
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'), |
||||
|
] |
@ -0,0 +1,21 @@ |
|||||
|
# Pension |
||||
|
|
||||
|
Webové stránky "pensionu" zpravidla obsahují: |
||||
|
|
||||
|
- domovskou stránku |
||||
|
- další stránky s informacemi o pensionu (např. kontakty) |
||||
|
- galerie nabídky ubytování |
||||
|
- tipy na výlety |
||||
|
|
||||
|
## statické stránky |
||||
|
- formátovaný text |
||||
|
- obrázky |
||||
|
|
||||
|
## galerie |
||||
|
- obrázky |
||||
|
- název |
||||
|
|
||||
|
## tipy na výlety |
||||
|
- obrázky |
||||
|
- popisek |
||||
|
- odkaz |
@ -0,0 +1,35 @@ |
|||||
|
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 StrankaPage(Page): |
||||
|
body = RichTextField(blank=True) |
||||
|
|
||||
|
search_fields = Page.search_fields + [ |
||||
|
index.SearchField('body'), |
||||
|
] |
||||
|
|
||||
|
content_panels = Page.content_panels + [ |
||||
|
FieldPanel('body', classname="full"), |
||||
|
InlinePanel('gallery_images', label="Obrázky"), |
||||
|
] |
||||
|
|
||||
|
|
||||
|
class StrankaPageGalleryImage(Orderable): |
||||
|
page = ParentalKey(StrankaPage, 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'), |
||||
|
] |
@ -0,0 +1,30 @@ |
|||||
|
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 TipyIndexPage(Page): |
||||
|
pass |
||||
|
|
||||
|
|
||||
|
class TipPage(Page): |
||||
|
popisek = models.CharField(max_length=250) |
||||
|
image = models.ForeignKey( |
||||
|
'wagtailimages.Image', on_delete=models.CASCADE, related_name='+' |
||||
|
) |
||||
|
|
||||
|
search_fields = Page.search_fields + [ |
||||
|
index.SearchField('popisek'), |
||||
|
] |
||||
|
|
||||
|
content_panels = Page.content_panels + [ |
||||
|
FieldPanel('popisek'), |
||||
|
FieldPanel('image'), |
||||
|
] |
||||
|
|
Loading…
Reference in new issue