Opened 13 years ago
Closed 13 years ago
#17170 closed Bug (duplicate)
django.forms.fields.CharField.widget_attrs wrong return
Reported by: | Csaba Tóth | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The "django.forms.fields.CharField" objects method widget_attrs haven't got enough return, it should return with empty dict if the if runs to false. But i think the best if it calls the super class' method, which is yet returns an empty dict (django.forms.fields.Field)
def widget_attrs(self, widget): if self.max_length is not None and isinstance(widget, (TextInput, PasswordInput)): # The HTML attribute is maxlength, not max_length. return {'maxlength': str(self.max_length)} + else: + return Field.widget_attrs(self, widget)
Change History (3)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 13 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Thanks for the report. Closing this ticket as a duplicate of #15912.
Note:
See TracTickets
for help on using tickets.
Because it returns None, this code didn't work for me:
Because
widget_attr(forms.HiddenInput())
returns a None object, and{}.update(None)
throws an exception