From 162405c1d1b3ca112ae71b3cc93d3689b9e89822 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 16 Aug 2018 12:38:41 +0200 Subject: Manage ope prefixes with the profile --- archaeological_context_records/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'archaeological_context_records/models.py') diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 3cb0313dd..e3c7ff4e5 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 + RelationItem, Town, get_current_profile from archaeological_operations.models import Operation, Period, Parcel, \ ArchaeologicalSite @@ -436,6 +436,8 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, return kwargs['transaction_id'] = transaction_id + profile = get_current_profile() + sql = """ UPDATE "archaeological_context_records_contextrecord" AS cr SET cached_label = @@ -469,8 +471,8 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, SELECT id FROM archaeological_context_records_contextrecord WHERE {where} ); - """.format(main_ope_prefix=settings.ISHTAR_OPE_PREFIX, - ope_prefix=settings.ISHTAR_DEF_OPE_PREFIX, + """.format(main_ope_prefix=profile.operation_prefix, + ope_prefix=profile.default_operation_prefix, join=settings.JOINT, where=where) with connection.cursor() as c: c.execute(sql, args) -- cgit v1.2.3