Implement template-based widget rendering
|Reported by:||brutasse||Owned by:||brutasse|
|Cc:||carl@…, idan@…, jezdez, ironfroggy@…, poswald, brutasse, trebor74hr@…, gregor@…, JMagnusson, dmclain, mathieu.agopian@…, tom@…, tgecho, dguardiola@…, mmitar@…, philipe.rp@…, Gwildor||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||yes|
Following this proposal on django-dev, this ticket tracks the status of replacing the widgets rendering code with a template-based system.
The proposal is based on an existing implementation, django-floppyforms. The api provides several ways of extending a widget:
- Widget.template_name: the name of the template used to render the widget
- Widget.get_context_data(): a way to inject additional context data
- Widget.get_context(name, value, attrs=None): this method calls get_context_data() and provides the basic context variables: attrs, hidden, name, required, type.
I'm actively working on a patch and will attach it to the ticket as soon as I can so that the implementation and extension points can be discussed.
Change History (41)
comment:1 Changed 4 years ago by carljm
- Cc carl@… added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
Changed 4 years ago by akaariai
comment:27 Changed 3 years ago by carljm
- Keywords form-rendering added
- Patch needs improvement set
- UI/UX unset