summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-05-14 16:02:33 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:20 +0100
commit5fa2a1d83d08fe47ce8285d3d350b5d5da103edd (patch)
tree63d6dbce538def79fc2a007a6c841427ede69a05 /ishtar_common/models.py
parentcbd38f88d2fa64f29ac2ee8eac73bdc2c0377cb2 (diff)
downloadIshtar-5fa2a1d83d08fe47ce8285d3d350b5d5da103edd.tar.bz2
Ishtar-5fa2a1d83d08fe47ce8285d3d350b5d5da103edd.zip
Documents - add format, scale, associated containers
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 6eea042ce..4b9253b03 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -5525,6 +5525,15 @@ class Document(BaseHistorizedItem, QRCodeItem, OwnPerms, ImageModel,
verbose_name=_("Receipt date in documentation"))
item_number = models.IntegerField(_("Number of items"), default=1)
description = models.TextField(_("Description"), blank=True, null=True)
+ container = models.ForeignKey(
+ "archaeological_warehouse.Container", verbose_name=_("Container"),
+ blank=True, null=True, related_name='contained_documents',
+ on_delete=models.SET_NULL)
+ container_ref = models.ForeignKey(
+ "archaeological_warehouse.Container",
+ verbose_name=_("Reference container"),
+ blank=True, null=True,
+ related_name='contained_documents_ref', on_delete=models.SET_NULL)
comment = models.TextField(_("Comment"), blank=True, null=True)
additional_information = models.TextField(_("Additional information"),
blank=True, null=True)
@@ -5573,6 +5582,15 @@ class Document(BaseHistorizedItem, QRCodeItem, OwnPerms, ImageModel,
def duplicate_item(self, user=None, data=None):
return duplicate_item(self, user, data)
+ @property
+ def source_type_html(self):
+ source_types = []
+ source_type = self.source_type
+ while source_type:
+ source_types.append(str(source_type))
+ source_type = source_type.parent
+ return " / ".join(reversed(source_types))
+
def public_representation(self):
site = Site.objects.get_current()
if settings.ISHTAR_SECURE: