2024-12-10 22:05:36 +00:00
|
|
|
"""
|
|
|
|
Page and section models.
|
|
|
|
"""
|
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
from cms.decorators import page_model, section_model
|
2021-07-03 23:59:48 +00:00
|
|
|
from cms.models import BasePage, BaseSection
|
2022-01-29 11:56:45 +00:00
|
|
|
from django.db import models
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
2021-07-03 23:59:48 +00:00
|
|
|
|
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):
|
2022-01-29 11:56:45 +00:00
|
|
|
pass
|
2021-07-03 23:59:48 +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):
|
2021-07-03 23:59:48 +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):
|
2021-07-03 23:59:48 +00:00
|
|
|
section = models.ForeignKey(
|
|
|
|
Section, related_name="images", on_delete=models.CASCADE
|
|
|
|
)
|
|
|
|
image = models.ImageField(_("Image"))
|
2020-01-05 02:36:23 +00:00
|
|
|
|
2020-01-02 18:32:15 +00:00
|
|
|
class Meta:
|
2021-07-03 23:59:48 +00:00
|
|
|
ordering = ["pk"]
|