#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.2c2698f485091c72a56863654c863989%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to