from django.db import models
|
from wagtail.admin.panels import FieldPanel
|
from wagtail.images.edit_handlers import ImageChooserPanel
|
|
|
class Book(models.Model):
|
title = models.CharField(max_length=255)
|
author = models.CharField(max_length=255)
|
cover_photo = models.ForeignKey(
|
'wagtailimages.Image',
|
on_delete=models.CASCADE,
|
related_name='+'
|
)
|
|
panels = [
|
FieldPanel('title'),
|
FieldPanel('author'),
|
ImageChooserPanel('cover_photo')
|
]
|
|
|
class Genre(models.Model):
|
title = models.CharField(max_length=255)
|
author = models.CharField(max_length=255)
|
cover_photo = models.ForeignKey(
|
'wagtailimages.Image',
|
on_delete=models.CASCADE,
|
related_name='+'
|
)
|
|
panels = [
|
FieldPanel('title'),
|
FieldPanel('author'),
|
ImageChooserPanel('cover_photo')
|
]
|
|
|
class Author(models.Model):
|
title = models.CharField(max_length=255)
|
author = models.CharField(max_length=255)
|
cover_photo = models.ForeignKey(
|
'wagtailimages.Image',
|
on_delete=models.CASCADE,
|
related_name='+'
|
)
|
|
panels = [
|
FieldPanel('title'),
|
FieldPanel('author'),
|
ImageChooserPanel('cover_photo')
|
]
|