#22245 closed Bug (fixed)
Widget on DecimalField subclass ignored
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | How to create a pull request | ||
Description ¶
I have a subclass of DecimalField with a widget member set, like so:
class ParameterField(DecimalField): widget = ParameterWidget
This works in Django 1.5 (by way of the constructor of Field, I guess). Django 1.6 doesn't pick up the specialised widget. IntegerField does a setdefault on widget that I can't follow:
class IntegerField(Field): ... def __init__(self, max_value=None, min_value=None, *args, **kwargs): self.max_value, self.min_value = max_value, min_value kwargs.setdefault('widget', NumberInput if not kwargs.get('localize') else self.widget) super(IntegerField, self).__init__(*args, **kwargs)
Adding localize = False
to the ParameterField class doesn't help because that doesn't make it appear in kwargs for IntegerField.
Change History (6)
comment:1 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Bug |
by , 11 years ago
Attachment: | 22245-1.diff added |
---|
comment:2 by , 11 years ago
Has patch: | set |
---|
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Suggested fix