Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9787 closed (invalid)

PasswordInput widget's max_length wrong output.

Reported by: patrick91 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: UI/UX:


when I use this code:

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


{{ form.as_table }}

I get this output:

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

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 Changed 7 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

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 Changed 7 years ago by patrick91

thank you very much :)

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