Browse Source

popisy modelů

master
mist 5 years ago
parent
commit
1a95af9097
  1. 22
      filmovy-festival/home/models.py
  2. 53
      filmovy-festival/program/models.py
  3. 25
      filmovy-festival/readme.md
  4. 35
      filmovy-festival/stranka/models.py
  5. 61
      showroom/catalog/models.py
  6. 0
      showroom/models.py
  7. 19
      showroom/readme.md
  8. 35
      showroom/stranka/models.py
  9. 0
      veterinarni-klinika/aktuality/models.py
  10. 55
      veterinarni-klinika/blog/models.py
  11. 22
      veterinarni-klinika/home/models.py
  12. 27
      veterinarni-klinika/readme.md
  13. 35
      veterinarni-klinika/stranka/models.py

22
filmovy-festival/home/models.py

@ -0,0 +1,22 @@
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.images.edit_handlers import ImageChooserPanel
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel
class HomePage(Page):
body = RichTextField(blank=True)
address = RichTextField(blank=True)
image = models.ForeignKey(
'wagtailimages.Image', on_delete=models.CASCADE, related_name='+'
)
content_panels = Page.content_panels + [
FieldPanel('body', classname="full"),
FieldPanel('address', classname="full"),
ImageChooserPanel('image'),
]

53
filmovy-festival/program/models.py

@ -0,0 +1,53 @@
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'),
]

25
filmovy-festival/readme.md

@ -0,0 +1,25 @@
# Filmový festival
Webové stránky filmového festivalu zpravidla obsahují:
- domovskou stránku s průvodním textem a hlavním "bannerem/obrázkem" festivalu
- statické stránky s informacemi o festivalu, pořadatelích nebo sponzorech
- program
## homepage
- hlavní foto
- průvodní text
## statické stránky
- formátovaný text
- obrázky
## program
- datum a čas projekce
- místo projekce
- název filmu
- datum vydání filmu
- režie
- země
- anotace k filmu
- obrázek k filmu

35
filmovy-festival/stranka/models.py

@ -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'),
]

61
showroom/catalog/models.py

@ -0,0 +1,61 @@
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 CategoryList(Page):
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('intro', classname="full"),
ImageChooserPanel('image'),
]
class Product(Page):
price = models.PositiveIntegerField()
description = RichTextField(blank=True)
def main_image(self):
gallery_item = self.gallery_images.first()
if gallery_item:
return gallery_item.image
else:
return None
parent_page_types = ['catalog.CategoryList', ]
search_fields = Page.search_fields + [
index.SearchField('description'),
]
content_panels = Page.content_panels + [
FieldPanel('price'),
FieldPanel('description', classname="full"),
InlinePanel('gallery_images', label="Obrázky"),
]
class ProductImage(Orderable):
page = ParentalKey(BlogPage, on_delete=models.CASCADE, related_name='product_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
showroom/models.py

19
showroom/readme.md

@ -0,0 +1,19 @@
# Showroom
Webové stránky "showroom" zpravidla obsahují:
- domovskou stránku s hlavním produktem (scoll page design)
- další stránky s informacemi o produktu (např. technické specifikace)
- katalog dalších produktů
## statické stránky
- formátovaný text
- obrázky
## katalog
- obrázky
- název
- popis
- kategorie produktu
- cena
- parametry (dle produktu)

35
showroom/stranka/models.py

@ -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
veterinarni-klinika/aktuality/models.py

55
veterinarni-klinika/blog/models.py

@ -0,0 +1,55 @@
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 BlogIndexPage(Page):
intro = RichTextField(blank=True)
content_panels = Page.content_panels + [
FieldPanel('intro', classname="full")
]
class BlogPage(Page):
date = models.DateField("Post date")
intro = models.CharField(max_length=250)
body = RichTextField(blank=True)
def main_image(self):
gallery_item = self.gallery_images.first()
if gallery_item:
return gallery_item.image
else:
return None
search_fields = Page.search_fields + [
index.SearchField('intro'),
index.SearchField('body'),
]
content_panels = Page.content_panels + [
FieldPanel('date'),
FieldPanel('intro'),
FieldPanel('body', classname="full"),
InlinePanel('gallery_images', label="Obrázky"),
]
class BlogPageGalleryImage(Orderable):
page = ParentalKey(BlogPage, 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'),
]

22
veterinarni-klinika/home/models.py

@ -0,0 +1,22 @@
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.images.edit_handlers import ImageChooserPanel
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel
class HomePage(Page):
body = RichTextField(blank=True)
address = RichTextField(blank=True)
image = models.ForeignKey(
'wagtailimages.Image', on_delete=models.CASCADE, related_name='+'
)
content_panels = Page.content_panels + [
FieldPanel('body', classname="full"),
FieldPanel('address', classname="full"),
ImageChooserPanel('image'),
]

27
veterinarni-klinika/readme.md

@ -0,0 +1,27 @@
# Veterinární klinika
Webové stránky veterinární kliniky zpravidla obsahují:
- domovskou stránku s průvodním textem a hlavním "bannerem/obrázkem"
kontakt / adresu kliniky
- statické stránky s dalšími informacemi o klinice: vybavení, služby, popis pracoviště
- aktuality - informace provozu kliniky, nedostupnosti lékaře, atp.
- blog o činnosti kliniky (např. úspěšné léčby/příběhy pacientů)
## stránky
- formátovaný text
- obrázky
## aktuality
- datum
- text zprávy
## blog
- datum
- text zápisu
- obrázky
## homepage
- adresa
- hlavní foto

35
veterinarni-klinika/stranka/models.py

@ -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'),
]
Loading…
Cancel
Save