From b114fa6d0b42a0ba2bc1a1988c1714f48d6a5474 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 14 May 2016 16:22:06 +0200 Subject: Finds: basket (db) --- 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 9509b36a6..3162a4843 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -475,6 +475,24 @@ class GeneralType(models.Model, Cached): item.generate_key() +class Basket(models.Model): + """ + Abstract class for a basket + Subclass must be defined with an "items" ManyToManyField + """ + label = models.CharField(_(u"Label"), max_length=1000) + comment = models.TextField(_(u"Comment"), blank=True, null=True) + user = models.ForeignKey('IshtarUser', blank=True, null=True) + available = models.BooleanField(_(u"Available"), default=True) + + class Meta: + abstract = True + unique_together = (('label', 'user'),) + + def __unicode__(self): + return self.label + + class ItemKey(models.Model): key = models.CharField(_(u"Key"), max_length=100) content_type = models.ForeignKey(ContentType) -- cgit v1.2.3