summaryrefslogtreecommitdiff
path: root/ishtar_common/widgets.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r--ishtar_common/widgets.py15
1 files changed, 10 insertions, 5 deletions
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("-", "_"),