summaryrefslogtreecommitdiff
path: root/archaeological_context_records/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-01-11 16:19:59 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-01-11 16:19:59 +0100
commit1e05946531d237dc954f46ddfc25a6b61c084a74 (patch)
tree8b9137dd9b68121db86e4e22dfdb7b7016a6f1ad /archaeological_context_records/models.py
parent4779acd3006e6d6b17babd13585a4d83fb8d2332 (diff)
parent9eced41d76545bd2921605b7b81bd14b875ce541 (diff)
downloadIshtar-1e05946531d237dc954f46ddfc25a6b61c084a74.tar.bz2
Ishtar-1e05946531d237dc954f46ddfc25a6b61c084a74.zip
Merge branch 'develop'
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r--archaeological_context_records/models.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 89f3edee4..d7d7a618d 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -84,6 +84,23 @@ class Dating(models.Model):
return unicode(self.period)
return u"%s (%s-%s)" % (self.period, start_date, end_date)
+ @classmethod
+ def is_identical(cls, dating_1, dating_2):
+ """
+ Compare two dating attribute by attribute and return True if all
+ attribute is identical
+ """
+ for attr in ["period", "start_date", "end_date", "dating_type",
+ "quality", "precise_dating"]:
+ value1 = getattr(dating_1, attr)
+ value2 = getattr(dating_2, attr)
+ if attr == "precise_dating":
+ value1 = value1.strip()
+ value2 = value2.strip()
+ if value1 != value2:
+ return False
+ return True
+
def context_records_lbl(self):
return u" - ".join(
[cr.cached_label for cr in self.context_records.all()]
@@ -521,6 +538,9 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem,
def get_query_owns(cls, ishtaruser):
q = cls._construct_query_own(
'operation__', Operation._get_query_owns_dicts(ishtaruser)
+ ) | cls._construct_query_own(
+ 'base_finds__find__basket__',
+ [{"shared_with": ishtaruser, "shared_write_with": ishtaruser}]
) | cls._construct_query_own('', [
{'history_creator': ishtaruser.user_ptr},
{'operation__end_date__isnull': True}