2020-01-05 02:36:23 +00:00
|
|
|
from django.db import models
|
2020-03-21 17:49:41 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2020-03-22 11:46:10 +00:00
|
|
|
from cms.models import BasePage, BaseSection
|
|
|
|
from cms.decorators import page_model, section_model
|
2020-01-02 00:56:15 +00:00
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
@page_model
|
2020-01-02 00:56:15 +00:00
|
|
|
class Page(BasePage):
|
2020-03-21 17:49:41 +00:00
|
|
|
'''Add custom fields here. Already existing fields: title, slug,
|
|
|
|
number, menu
|
2020-01-02 00:56:15 +00:00
|
|
|
|
|
|
|
'''
|
2019-12-31 12:05:12 +00:00
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
@section_model
|
2019-12-31 12:05:12 +00:00
|
|
|
class Section(BaseSection):
|
2020-03-21 17:49:41 +00:00
|
|
|
'''Add custom fields here. Already existing fields: title, type,
|
|
|
|
number, content, image, video, href
|
2019-12-31 12:05:12 +00:00
|
|
|
|
|
|
|
'''
|
2020-03-22 20:19:12 +00:00
|
|
|
page = models.ForeignKey(Page, related_name='sections', on_delete=models.PROTECT)
|
2019-12-31 12:05:12 +00:00
|
|
|
|
2020-03-21 17:49:41 +00:00
|
|
|
class SectionImage(models.Model):
|
2020-03-22 18:57:48 +00:00
|
|
|
section = models.ForeignKey(Section, related_name='images', on_delete=models.CASCADE)
|
2020-03-21 17:49:41 +00:00
|
|
|
image = models.ImageField(_('Image'))
|
2020-01-05 02:36:23 +00:00
|
|
|
|
2020-01-02 18:32:15 +00:00
|
|
|
class Meta:
|
2020-03-21 17:49:41 +00:00
|
|
|
ordering = ['pk']
|