From 785d6dbe94ef643ddbd1860de9bf9318878a4e35 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 16 Oct 2018 15:34:00 +0200 Subject: Disable site naturalk key (circular dependency problem with operations) --- archaeological_context_records/models.py | 4 ++-- archaeological_finds/models_finds.py | 6 ++---- archaeological_finds/models_treatments.py | 3 +-- archaeological_operations/models.py | 7 +++++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 58acfd148..60f8fce1b 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -34,8 +34,8 @@ from ishtar_common.utils import cached_label_changed 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, ExternalIdManager + post_save_cache, ValueGetter, BulkUpdatedItem, ExternalIdManager, \ + RelationItem, Town, get_current_profile from archaeological_operations.models import Operation, Period, Parcel, \ ArchaeologicalSite diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 539ba2325..1ef9d5846 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -38,14 +38,12 @@ from ishtar_common.alternative_configs import ALTERNATE_CONFIGS from ishtar_common.models import Document, GeneralType, \ HierarchicalType, BaseHistorizedItem, ShortMenuItem, LightHistorizedItem, \ HistoricalRecords, OwnPerms, Person, Basket, post_save_cache, \ - ValueGetter, get_current_profile, IshtarSiteProfile + ValueGetter, get_current_profile, IshtarSiteProfile, PRIVATE_FIELDS, \ + SpatialReferenceSystem, BulkUpdatedItem, ExternalIdManager from archaeological_operations.models import AdministrativeAct, Operation from archaeological_context_records.models import ContextRecord, Dating -from ishtar_common.models import PRIVATE_FIELDS, SpatialReferenceSystem, \ - BulkUpdatedItem, ExternalIdManager - class MaterialType(HierarchicalType): code = models.CharField(_(u"Code"), max_length=10, blank=True, null=True) diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 93a45164b..6a57a77f5 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -27,14 +27,13 @@ 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 from ishtar_common.models import Document, GeneralType, \ ImageModel, BaseHistorizedItem, OwnPerms, HistoricalRecords, Person, \ Organization, ValueGetter, post_save_cache, ShortMenuItem, \ - DashboardFormItem + DashboardFormItem, ExternalIdManager from ishtar_common.utils import cached_label_changed, get_current_year diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index c4d7e489c..d3a839558 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -84,10 +84,12 @@ class ReportState(GeneralType): post_save.connect(post_save_cache, sender=ReportState) post_delete.connect(post_save_cache, sender=ReportState) + class SiteManager(models.Manager): def get_by_natural_key(self, txt_idx): return self.get(reference=txt_idx) + class RecordQualityType(GeneralType): order = models.IntegerField(_(u"Order")) @@ -269,8 +271,8 @@ class ArchaeologicalSite(BaseHistorizedItem, OwnPerms, ValueGetter, ])) return name - def natural_key(self): - return (self.reference, ) + # def natural_key(self): + # return (self.reference, ) @property def external_id(self): @@ -386,6 +388,7 @@ class ClosedItem(object): user = q.all()[0] return {'date': date, 'user': user} + class OperationManager(models.Manager): def get_by_natural_key(self, txt_idx): return self.get(code_patriarche=txt_idx) -- cgit v1.2.3