diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-08-21 18:28:17 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-08-21 18:28:17 +0200 |
commit | c0eb7726323ec0cf710a5d4b2761d80849184953 (patch) | |
tree | bf048f802edc673bb223ca224608064b1e64587f /ishtar_common | |
parent | 1848a2fcab0d22056a2979459093a54c71f4060d (diff) | |
download | Ishtar-c0eb7726323ec0cf710a5d4b2761d80849184953.tar.bz2 Ishtar-c0eb7726323ec0cf710a5d4b2761d80849184953.zip |
Fix model configuration errors
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models.py | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 725c3ac83..082991824 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -762,38 +762,6 @@ class GeneralType(Cached, models.Model): item.generate_key() -class Basket(models.Model): - """ - Abstract class for a basket - Subclass must be defined with an "items" ManyToManyField - """ - IS_BASKET = True - 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 - - @property - def cached_label(self): - return unicode(self) - - @classmethod - def get_short_menu_class(cls, pk): - return 'basket' - - @property - def associated_filename(self): - return "{}-{}".format(datetime.date.today().strftime( - "%Y-%m-%d"), slugify(self.label)) - - class ItemKey(models.Model): key = models.CharField(_(u"Key"), max_length=100) content_type = models.ForeignKey(ContentType) @@ -1311,7 +1279,7 @@ class IshtarSiteProfile(models.Model, Cached): u"data can be destructive.")) active = models.BooleanField(_(u"Current active"), default=False) currency = models.CharField(_(u"Currency"), default=u"€", - choices=CURRENCY, max_length='5') + choices=CURRENCY, max_length=5) class Meta: verbose_name = _(u"Ishtar site profile") @@ -2277,6 +2245,38 @@ class IshtarUser(models.Model): return res +class Basket(models.Model): + """ + Abstract class for a basket + Subclass must be defined with an "items" ManyToManyField + """ + IS_BASKET = True + 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 + + @property + def cached_label(self): + return unicode(self) + + @classmethod + def get_short_menu_class(cls, pk): + return 'basket' + + @property + def associated_filename(self): + return "{}-{}".format(datetime.date.today().strftime( + "%Y-%m-%d"), slugify(self.label)) + + class AuthorType(GeneralType): order = models.IntegerField(_(u"Order"), default=1) |