summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_treatments.py
diff options
context:
space:
mode:
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
commit397858e3dbe21488711c739028cc4803a37076d1 (patch)
treead04d9e574e9d1523ae3b967fc781f0b9d2c3238 /archaeological_finds/models_treatments.py
parent0049a4f8ad6e1dfa9a5086131a631267621d6058 (diff)
downloadIshtar-397858e3dbe21488711c739028cc4803a37076d1.tar.bz2
Ishtar-397858e3dbe21488711c739028cc4803a37076d1.zip
Natural keys for operations, context records, finds, etc.
Diffstat (limited to 'archaeological_finds/models_treatments.py')
-rw-r--r--archaeological_finds/models_treatments.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py
index 291a75d4c..93a45164b 100644
--- a/archaeological_finds/models_treatments.py
+++ b/archaeological_finds/models_treatments.py
@@ -27,6 +27,7 @@ from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _, pgettext_lazy, \
activate, deactivate
+from ishtar_common.models import ExternalIdManager
from archaeological_finds.models_finds import Find, FindBasket, TreatmentType
from archaeological_operations.models import ClosedItem, Operation
from archaeological_warehouse.models import Warehouse, Container
@@ -113,6 +114,8 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem,
INT_SEARCH_VECTORS = ["year", "index"]
M2M_SEARCH_VECTORS = ['downstream__cached_label', 'upstream__cached_label']
PARENT_SEARCH_VECTORS = ['person', 'organization']
+ objects = ExternalIdManager()
+
label = models.CharField(_(u"Label"), blank=True, null=True,
max_length=200)
other_reference = models.CharField(_(u"Other ref."), blank=True, null=True,
@@ -187,6 +190,9 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem,
def short_class_name(self):
return _(u"TREATMENT")
+ def natural_key(self):
+ return (self.external_id, )
+
@classmethod
def get_query_owns(cls, ishtaruser):
return (Q(history_creator=ishtaruser.user_ptr) |