diff options
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 22 |
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}", |
