summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-11-02 19:15:50 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:21 +0100
commitd96c631b601ab7acb161e160ce9dcd14da0820aa (patch)
treecaa79b9e4cb2f9fff669e8389c8369ee3046e2c5 /ishtar_common/models.py
parent1e3da04336b9095e4497d098ea19c3178bc74cf6 (diff)
downloadIshtar-d96c631b601ab7acb161e160ce9dcd14da0820aa.tar.bz2
Ishtar-d96c631b601ab7acb161e160ce9dcd14da0820aa.zip
Import template: add description list - Simplify document import
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index f23cab926..483e15786 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1664,6 +1664,15 @@ class Organization(Address, Merge, OwnPerms, ValueGetter, MainItem):
if getattr(self, attr)]
return slugify("-".join(values))
+ @classmethod
+ @pre_importer_action
+ def import_get_publisher_type(cls, context, value):
+ if context["name"]:
+ q = OrganizationType.objects.filter(txt_idx='publisher')
+ if not q.count():
+ return
+ context["organization_type"] = q.all()[0]
+
post_save.connect(cached_label_changed, sender=Organization)
@@ -3256,6 +3265,10 @@ class Document(BaseHistorizedItem, QRCodeItem, OwnPerms, ImageModel,
cid = 0
return cid + 1
+ @classmethod
+ def get_import_defaults(cls):
+ return {"index": cls.get_next_index()}
+
def set_index(self):
if self.index:
return