{{{
class CoffeeField(django.forms.CharField):
widget = CoffeeWidget
>>> CoffeeField().widget
<CoffeeWidget object at 0xc0ffeec0ffee>
}}}
However, with `contrib.postgres.forms.jsonb.JSONField` this doesn't work.
Instead, once must override `__init__()` or pass `widget` in as a kwarg.
Luckily, it's pretty easy to fix, and I've almost completed writing a
patch. I'll link to it here once done.
--
Ticket URL: <https://code.djangoproject.com/ticket/26748>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Patch submitted https://github.com/django/django/pull/6764
--
Ticket URL: <https://code.djangoproject.com/ticket/26748#comment:1>
* version: 1.9 => master
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26748#comment:2>
Comment (by meshy):
Thank you for accepting the patch, charettes :)
I'm curious what the policy is here -- will this be backported into
existing versions, or will this become available when 1.10 comes out?
--
Ticket URL: <https://code.djangoproject.com/ticket/26748#comment:3>
* status: new => closed
* owner: => Tim Graham <timograham@…>
* resolution: => fixed
Comment:
In [changeset:"f2c0eb19e961f5864573251e70bdcdecd0250aed" f2c0eb19]:
{{{
#!CommitTicketReference repository=""
revision="f2c0eb19e961f5864573251e70bdcdecd0250aed"
Fixed #26748 -- Allowed overriding JSONField's widget with an attribute.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26748#comment:4>
Comment (by timgraham):
This will be in 1.11, see our
[https://docs.djangoproject.com/en/dev/internals/release-process
/#supported-versions supported versions policy] for details on the
backport policy.
--
Ticket URL: <https://code.djangoproject.com/ticket/26748#comment:5>
--
Ticket URL: <https://code.djangoproject.com/ticket/26748#comment:6>
Comment (by meshy):
Great! Thanks for the link `:)`
--
Ticket URL: <https://code.djangoproject.com/ticket/26748#comment:7>