summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-09-16 10:29:22 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:20:58 +0100
commit7d235c4d2bdffe729608d928b48dc8f647ebe54d (patch)
treeb20ee23a82f76fc63ee99417007d57f310d34ceb /ishtar_common/models.py
parent9992bf5614ed22b99f0b341b3d4252c8f0c88e06 (diff)
downloadIshtar-7d235c4d2bdffe729608d928b48dc8f647ebe54d.tar.bz2
Ishtar-7d235c4d2bdffe729608d928b48dc8f647ebe54d.zip
Migration to Django 2.2 - fixes
- rel -> remote_field - to -> model - default initialization for historical models
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index b4d6eb0f2..6783a89b5 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -349,8 +349,13 @@ class HistoryModel(models.Model):
if not models.endswith(".models"):
models += ".models"
models = import_module(models)
- model = getattr(models, self.__class__.__name__[len("Historical") :])
- related_model = getattr(model, key).rel.model
+ model = getattr(models, self.__class__.__name__[len("Historical"):])
+ field = getattr(model, key)
+ 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)
@@ -4325,7 +4330,7 @@ class Document(
def get_query_owns(cls, ishtaruser):
query_own_list = []
for rel_model in cls.RELATED_MODELS:
- klass = getattr(cls, rel_model).rel.related_model
+ klass = getattr(cls, rel_model).remote_field.related_model
q_own_dct = klass._get_query_owns_dicts(ishtaruser)
if q_own_dct:
query_own_list.append((rel_model + "__", q_own_dct))