From 855d7df00ff702b8191bbe6bb44a21124799228e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 11 Jun 2020 11:59:00 +0200 Subject: New container: parent container search dependency (refs #4936) - remove + button for parent (refs #4937) --- ishtar_common/widgets.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'ishtar_common/widgets.py') diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index df0d09764..9483f9719 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -645,11 +645,16 @@ class JQueryAutoComplete(forms.TextInput): source = "'" + str(self.source) + "'" except: raise ValueError('source type is not valid') - dynamic_limit = [ - 'id_' + lim.replace('_', '') + '-' + - '-'.join(field_id.split('-')[1:-1]) + '-' + lim - for lim in self.dynamic_limit - ] + dynamic_limit = [] + for lim in self.dynamic_limit: + field_ids = field_id.split('-') + if field_ids[1:-1]: + dynamic_limit.append( + 'id_' + lim.replace('_', '') + '-' + + '-'.join(field_ids[1:-1]) + '-' + lim) + else: + dynamic_limit.append('id_' + lim.replace('_', '')) + dct = {'source': mark_safe(source), 'field_id': field_id, 'safe_field_id': field_id.replace("-", "_"), -- cgit v1.2.3