From 1282a64bcdca8d928f44a94bfdaaf47b934b4246 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 4 Oct 2017 11:29:13 +0200 Subject: Preservation module: add fields to models (refs #3639) --- ishtar_common/models.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index b0b050c6c..28a24115b 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -765,6 +765,22 @@ class GeneralType(Cached, models.Model): item.generate_key() +class HierarchicalType(GeneralType): + parent = models.ForeignKey('self', blank=True, null=True, + verbose_name=_(u"Parent")) + + class Meta: + abstract = True + + def full_label(self): + lbls = [self.label] + item = self + while item.parent: + item = item.parent + lbls.append(item.label) + return u" > ".join(reversed(lbls)) + + class ItemKey(models.Model): key = models.CharField(_(u"Key"), max_length=100) content_type = models.ForeignKey(ContentType) @@ -1255,6 +1271,8 @@ class IshtarSiteProfile(models.Model, Cached): warehouse_color = models.CharField( _(u"CSS code for warehouse module"), default=u'rgba(10,20,200,0.15)', max_length=200) + preservation = models.BooleanField(_(u"Preservation module"), + default=False) mapping = models.BooleanField(_(u"Mapping module"), default=False) mapping_color = models.CharField( _(u"CSS code for mapping module"), default=u'rgba(72, 236, 0, 0.15)', -- cgit v1.2.3