Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9787 closed (invalid)

PasswordInput widget's max_length wrong output.

Reported by: patrick Owned by: nobody
Component: Forms Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,
when I use this code:

#forms.py

class TestForm(forms.Form):
    check_password = forms.CharField(_('Password (verifica)'), widget=forms.PasswordInput)

#template.html

{{ form.as_table }}

I get this output:

<form action="." method="post">
<table>
 <tr>
  <td>
   <label for="id_nick_name">Nickname</label>
  </td>
  <td>
   <input id="id_password" type="password" name="password" maxlength="&lt;django.utils.functional.__proxy__ object at 0x2b5bb4d407d0&gt;" />
  </td>
 </tr>
</table>

the part: maxlength="&lt;django.utils.functional.proxy object at 0x2b5bb4d407d0&gt;" seems strange, i don't know hot get the correct ouput.

Change History (2)

comment:1 by Karen Tracey, 16 years ago

Resolution: invalid
Status: newclosed

The first positional argument for a forms.CharField is the maximum length for the field, see:

http://docs.djangoproject.com/en/dev/ref/forms/fields/#charfield

You are passing in _('Password (verifica)'). I'm assuming you mean that to be the label, in which case your form should be:

class TestForm(forms.Form):
    check_password = forms.CharField(label=_('Password (verifica)'), widget=forms.PasswordInput)

comment:2 by patrick, 16 years ago

thank you very much :)

Note: See TracTickets for help on using tickets.
Back to Top