From 50547a6b7d830c8b64c50517577540f231e5f551 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 15 Oct 2014 20:13:20 +0200 Subject: Fix date widget: no autocompletion, fix bad name for JS (refs #2067) --- ishtar_common/widgets.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ishtar_common/widgets.py') diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index e0556a7b7..f257801d8 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -117,12 +117,16 @@ class JQueryDate(forms.TextInput): values = value.split('/') if len(values) == 3: value = "%s-%s-%s" % (values[2], values[1], values[0]) + if not attrs: + attrs = {} + attrs['autocomplete'] = 'off' rendered = super(JQueryDate, self).render(name, value, attrs) # use window.onload to be sure that datepicker don't interfere # with autocomplete fields + var_name = name.replace('-', '_') rendered += """ -""" % {"name":name, "country":settings.COUNTRY} +""" % {"name":name, "var_name":var_name, "country":settings.COUNTRY} return rendered class JQueryAutoComplete(forms.TextInput): -- cgit v1.2.3