[Django] #22245: Widget on DecimalField subclass ignored

9 views
Skip to first unread message

Django

unread,
Mar 11, 2014, 6:32:04 AM3/11/14
to django-...@googlegroups.com
#22245: Widget on DecimalField subclass ignored
---------------------------------+--------------------
Reporter: jeroen.pulles@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/22245>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 11, 2014, 10:56:03 AM3/11/14
to django-...@googlegroups.com
#22245: Widget on DecimalField subclass ignored
---------------------------------+------------------------------------
Reporter: jeroen.pulles@… | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by claudep):

* needs_better_patch: => 0
* needs_docs: => 0
* type: Uncategorized => Bug
* needs_tests: => 0
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/22245#comment:1>

Django

unread,
Mar 11, 2014, 1:09:36 PM3/11/14
to django-...@googlegroups.com
#22245: Widget on DecimalField subclass ignored
---------------------------------+------------------------------------
Reporter: jeroen.pulles@… | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/22245#comment:2>

Django

unread,
Mar 12, 2014, 2:33:30 PM3/12/14
to django-...@googlegroups.com
#22245: Widget on DecimalField subclass ignored
-------------------------------------+-------------------------------------
Reporter: jeroen.pulles@… | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):

* stage: Accepted => Ready for checkin


Comment:

Patch looks RFC.

--
Ticket URL: <https://code.djangoproject.com/ticket/22245#comment:3>

Django

unread,
Mar 13, 2014, 11:59:03 AM3/13/14
to django-...@googlegroups.com
#22245: Widget on DecimalField subclass ignored
-------------------------------------+-------------------------------------
Reporter: jeroen.pulles@… | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.6
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"5a976b4bec79cdb6b75581be6478356fb13fda77"]:
{{{
#!CommitTicketReference repository=""
revision="5a976b4bec79cdb6b75581be6478356fb13fda77"
Fixed #22245 -- Avoided widget overwrite in forms.IntegerField subclasses

Thanks Jeroen Pulles for the report and Simon Charette for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22245#comment:4>

Django

unread,
Mar 13, 2014, 12:00:08 PM3/13/14
to django-...@googlegroups.com
#22245: Widget on DecimalField subclass ignored
-------------------------------------+-------------------------------------
Reporter: jeroen.pulles@… | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.6

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"1a2939bc26b7077e3196cea9bce52826ec7a6d9d"]:
{{{
#!CommitTicketReference repository=""
revision="1a2939bc26b7077e3196cea9bce52826ec7a6d9d"
[1.6.x] Fixed #22245 -- Avoided widget overwrite in forms.IntegerField
subclasses

Thanks Jeroen Pulles for the report and Simon Charette for the review.

Backport of 5a976b4bec7 from master.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22245#comment:5>

Reply all
Reply to author
Forward
0 new messages