summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-05-22 22:22:32 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-05-22 22:22:32 +0200
commite45b6042dd31f046226e29ad07e1638c7ff3b437 (patch)
treea4d6b2acc1167a30f51966f3da9df21eca1dfebc /ishtar_common/models.py
parenta35bb6b362f99f7b2c3d38dc8bbc54f234ac4dd7 (diff)
downloadIshtar-e45b6042dd31f046226e29ad07e1638c7ff3b437.tar.bz2
Ishtar-e45b6042dd31f046226e29ad07e1638c7ff3b437.zip
Find: sheet for basket - manage default basket selection
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 3162a4843..33ae05369 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -480,6 +480,7 @@ 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)
@@ -492,6 +493,14 @@ class Basket(models.Model):
def __unicode__(self):
return self.label
+ def get_short_menu_class(self):
+ 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)
@@ -569,6 +578,7 @@ class HistoryError(Exception):
class BaseHistorizedItem(Imported):
+ IS_BASKET = False
history_modifier = models.ForeignKey(
User, related_name='+', on_delete=models.SET_NULL,
verbose_name=_(u"Last editor"), blank=True, null=True)