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_finds/models_treatments.py | |
parent | b6f5261620d6518a0e5a9da1e638ab97be716609 (diff) | |
download | Ishtar-5aa11c751acecb6d5a3a56f45f74d17d64a358d1.tar.bz2 Ishtar-5aa11c751acecb6d5a3a56f45f74d17d64a358d1.zip |
Natural keys for operations, context records, finds, etc.
Diffstat (limited to 'archaeological_finds/models_treatments.py')
-rw-r--r-- | archaeological_finds/models_treatments.py | 6 |
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) | |