From 04e72696f1b6ad5434298f8429cbfe6587d3b84d Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Wed, 18 Oct 2017 16:53:32 +0200 Subject: [PATCH] Add About and AboutItem models --- ungleich_page/models.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ungleich_page/models.py b/ungleich_page/models.py index f961e373..57201f9d 100644 --- a/ungleich_page/models.py +++ b/ungleich_page/models.py @@ -11,7 +11,7 @@ class UngelichPicture(CMSPlugin): related_name="image", on_delete=models.SET_NULL ) - title = models.CharField(max_length=200) + title = models.CharField(max_length=400) class UngelichContactUsSection(CMSPlugin): @@ -47,3 +47,21 @@ class ServiceItem(CMSPlugin): def copy_relations(self, oldinstance): self.glasfaser_service = oldinstance.glasfaser_service + + +class About(Service): + pass + + +class AboutItem(UngelichPicture): + inverted = models.BooleanField(default=False) + glasfaser_about = models.ForeignKey(About) + + def __str__(self): + alignment = "Right" if self.inverted else "Left" + return "{alignment} - {title}".format( + alignment=alignment, title=self.title + ) + + def copy_relations(self, oldinstance): + self.glasfaser_about = oldinstance.glasfaser_about