dynamicweb/ungleich_page/models.py

74 lines
1.9 KiB
Python
Raw Normal View History

2017-10-17 13:52:30 +00:00
from cms.models.pluginmodel import CMSPlugin
from django.db import models
2017-10-17 15:51:01 +00:00
from djangocms_text_ckeditor.fields import HTMLField
2017-10-17 13:52:30 +00:00
from filer.fields.image import FilerImageField
2017-10-17 13:52:30 +00:00
class UngelichPicture(CMSPlugin):
image = FilerImageField(
null=True,
blank=True,
related_name="image",
on_delete=models.SET_NULL
)
2017-10-18 14:53:32 +00:00
title = models.CharField(max_length=400)
2017-10-17 14:25:01 +00:00
class SectionWithImage(UngelichPicture):
menu_text = models.CharField(max_length=100, default="", blank=True)
price_tag_image = FilerImageField(
null=True,
blank=True,
related_name="price_tag_image",
on_delete=models.SET_NULL
)
price_tag_url = models.URLField(max_length=300, default="", blank=True)
2017-10-17 14:25:01 +00:00
class UngelichContactUsSection(CMSPlugin):
menu_text = models.CharField(max_length=100, default="", blank=True)
2017-10-17 14:25:01 +00:00
email = models.EmailField(max_length=200)
2017-10-17 15:51:01 +00:00
class UngelichTextSection(CMSPlugin):
menu_text = models.CharField(max_length=100, default="", blank=True)
2017-10-17 15:51:01 +00:00
title = models.CharField(max_length=200)
description = HTMLField()
class Service(CMSPlugin):
menu_text = models.CharField(max_length=100, default="", blank=True)
title = models.CharField(max_length=200)
sub_title = models.CharField(max_length=200)
def __str__(self):
return self.title
class ServiceItem(CMSPlugin):
image = FilerImageField(
null=True,
blank=True,
related_name="service_item_image",
on_delete=models.SET_NULL
)
title = models.CharField(max_length=200)
description = HTMLField()
def __str__(self):
return self.title
2017-10-18 14:53:32 +00:00
class About(Service):
pass
class AboutItem(UngelichPicture):
inverted = models.BooleanField(default=False)
def __str__(self):
alignment = "Right" if self.inverted else "Left"
return "{alignment} - {title}".format(
alignment=alignment, title=self.title
)