diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-11-28 18:51:28 +0100 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-11-28 18:53:28 +0100 |
| commit | 13531adff386cc09c7f41c02ba7c116575cb6ee1 (patch) | |
| tree | 51067bbe4ac2bb44a139c2bc813d1442d2db4582 /archaeological_context_records/models.py | |
| parent | 1d26a7a62d150d19e659e66515fcda5a40c6c68a (diff) | |
| download | Ishtar-13531adff386cc09c7f41c02ba7c116575cb6ee1.tar.bz2 Ishtar-13531adff386cc09c7f41c02ba7c116575cb6ee1.zip | |
Treatments: better management of merge - tests
Diffstat (limited to 'archaeological_context_records/models.py')
| -rw-r--r-- | archaeological_context_records/models.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 89f3edee4..2e9af17c1 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()] |
