diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-16 12:10:17 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-16 12:10:17 +0200 |
commit | 5aa11c751acecb6d5a3a56f45f74d17d64a358d1 (patch) | |
tree | ad04d9e574e9d1523ae3b967fc781f0b9d2c3238 /archaeological_context_records | |
parent | b6f5261620d6518a0e5a9da1e638ab97be716609 (diff) | |
download | Ishtar-5aa11c751acecb6d5a3a56f45f74d17d64a358d1.tar.bz2 Ishtar-5aa11c751acecb6d5a3a56f45f74d17d64a358d1.zip |
Natural keys for operations, context records, finds, etc.
Diffstat (limited to 'archaeological_context_records')
-rw-r--r-- | archaeological_context_records/models.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 080fa54da..58acfd148 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -35,7 +35,7 @@ from ishtar_common.models import Document, GeneralType, \ BaseHistorizedItem, HistoricalRecords, OwnPerms, ShortMenuItem, \ GeneralRelationType, GeneralRecordRelations, post_delete_record_relation,\ post_save_cache, ValueGetter, BulkUpdatedItem, \ - RelationItem, Town, get_current_profile + RelationItem, Town, get_current_profile, ExternalIdManager from archaeological_operations.models import Operation, Period, Parcel, \ ArchaeologicalSite @@ -396,6 +396,7 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, blank=True) cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, db_index=True) + objects = ExternalIdManager() class Meta: verbose_name = _(u"Context Record") @@ -409,6 +410,9 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, ) ordering = ('cached_label',) + def natural_key(self): + return (self.external_id, ) + @property def name(self): return self.label or "" |