diff options
| author | Étienne Loks <etienne.loks@proxience.com> | 2014-10-15 20:13:20 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@proxience.com> | 2014-10-15 20:14:22 +0200 | 
| commit | 133c10d0cc535d8fd49406c9cd32d5bf972f2cb7 (patch) | |
| tree | 8560527a2e25b70ca65790bffb8ea647bc35878c | |
| parent | 3705e8647df680f2bc88f365de7bc5381a8da785 (diff) | |
| download | Ishtar-133c10d0cc535d8fd49406c9cd32d5bf972f2cb7.tar.bz2 Ishtar-133c10d0cc535d8fd49406c9cd32d5bf972f2cb7.zip | |
Fix date widget: no autocompletion, fix bad name for JS (refs #2067)
| -rw-r--r-- | ishtar_common/widgets.py | 10 | 
1 files changed, 7 insertions, 3 deletions
| 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 += """  <script type="text/javascript"><!--// -    function load_jquerydate_%(name)s(){ +    function load_jquerydate_%(var_name)s(){          $(".date-pickup").datepicker($.datepicker.regional["%(country)s"]);          var val = $("#id_%(name)s").val();          if(val){ @@ -133,9 +137,9 @@ class JQueryDate(forms.TextInput):              $("#id_%(name)s").val(val);          }      } -    $(window).load(load_jquerydate_%(name)s); +    $(window).load(load_jquerydate_%(var_name)s);  //--></script> -""" % {"name":name, "country":settings.COUNTRY} +""" % {"name":name, "var_name":var_name, "country":settings.COUNTRY}          return rendered  class JQueryAutoComplete(forms.TextInput): | 
