summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_finds.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r--archaeological_finds/models_finds.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index bda25f97c..539ba2325 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -44,7 +44,7 @@ from archaeological_operations.models import AdministrativeAct, Operation
from archaeological_context_records.models import ContextRecord, Dating
from ishtar_common.models import PRIVATE_FIELDS, SpatialReferenceSystem, \
- BulkUpdatedItem
+ BulkUpdatedItem, ExternalIdManager
class MaterialType(HierarchicalType):
@@ -302,6 +302,7 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms):
PARENT_SEARCH_VECTORS = ['context_record']
BASE_SEARCH_VECTORS = ["label", "description", "comment", "cache_short_id",
"cache_complete_id", "excavation_id"]
+ objects = ExternalIdManager()
class Meta:
verbose_name = _(u"Base find")
@@ -317,6 +318,9 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms):
def __unicode__(self):
return self.label
+ def natural_key(self):
+ return (self.external_id, )
+
def get_last_find(self):
# TODO: manage virtuals - property(last_find) ?
finds = self.find.filter().order_by("-order").all()
@@ -874,6 +878,7 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms,
M2M_SEARCH_VECTORS = [
"datings__period__label", "object_types__label", "integrities__label",
"remarkabilities__label", "material_types__label"]
+ objects = ExternalIdManager()
# fields
base_finds = models.ManyToManyField(BaseFind, verbose_name=_(u"Base find"),
@@ -1018,6 +1023,9 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms,
)
ordering = ('cached_label',)
+ def natural_key(self):
+ return (self.external_id, )
+
@property
def short_class_name(self):
return _(u"FIND")