summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-11-04 18:15:25 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-11-14 16:19:08 +0100
commit4a21e99df5cffd472acfe26013a350c302429d74 (patch)
treeaccd15795445e560dd56a1815cb8ca74095e42bd /ishtar_common/models.py
parentdbd200f4ba696631a37c7f6ee18b422c254f6a49 (diff)
downloadIshtar-4a21e99df5cffd472acfe26013a350c302429d74.tar.bz2
Ishtar-4a21e99df5cffd472acfe26013a350c302429d74.zip
✨ datings refactoring: models, migrations, sheets, admin
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 0ffb24882..aa9224be7 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -423,11 +423,14 @@ class HistoryModel(models.Model):
models = import_module(models)
model = getattr(models, self.__class__.__name__[len("Historical"):])
field = getattr(model, key)
- if hasattr(field, "rel"):
- field = field.rel
+ if not hasattr(field, "reverse"):
+ related_model = field.field.model
else:
- field = field.remote_field
- related_model = field.model
+ if hasattr(field, "rel"):
+ field = field.rel
+ else:
+ field = field.remote_field
+ related_model = field.model
return related_model.history_decompress(self.history_m2m[key], create=create)
@@ -1525,6 +1528,17 @@ class IshtarSiteProfile(models.Model, Cached):
"Formula to manage cached label. If not set a default formula is used."
),
)
+ dating_external_id = models.TextField(
+ _("Dating external id"),
+ default="{{parent_external_id}}-{% if reference %}{{reference}}"
+ "{% else %}{{auto_id}}{% endif %}",
+ help_text=_(
+ "Formula to manage dating external ID. "
+ "Change this with care. With incorrect formula, the "
+ "application might be unusable and import of external "
+ "data can be destructive."
+ ),
+ )
document_external_id = models.TextField(
_("Document external id"),
default="{index}",