Opened 9 years ago

Closed 9 years ago

#4616 closed (wontfix)

Widgets should be able to rendered separately

Reported by: fero <luca.ferroni@…> Owned by: nobody
Component: Forms Version: master
Severity: Keywords: SplitDateTimeWidget SplitDateTimeField template
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Hello, I spent this evening in trying to make the SplitDateTimeWidget working in the template.
I get a bound_field and I'd like to split visualization of date and time like this:

{% load i18n %}
<p class="datetime">

{% trans "Date:" %} a {{ bound_field.form.fields.datetime_start.fields.0 }}<br />
{% trans "Time:" %} b {{ bound_field.field.fields.1.widget }}


I can't make it works ! I tried many permutations of the components form, fields, field_name and widget and I've never reached a results.
Please correct this bug asap.

Change History (2)

comment:1 Changed 9 years ago by Matt Riggott

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from Widget SplitDateTimeWidget and field SplitDateTimeField unusable to Widgets should be able to rendered separately
  • Triage Stage changed from Unreviewed to Design decision needed

From what I gather, the request here is to allow widgets on bound fields to be rendered separately, which django.newforms doesn't currently allow. If so, this affects more than just SplitDateTimeWidget and SplitDateTimeField.

To solve this you could sub-class a widget's render method and roll your own, but a generic Django solution might be worthwhile. Marked as design decision needed.

comment:2 Changed 9 years ago by Matt Riggott

  • Resolution set to wontfix
  • Status changed from new to closed

A brief discussion on #django-sprint led to agreement that this isn't a common enough task to need support in Django core. Solution is to sub-class fields and widgets.

Note: See TracTickets for help on using tickets.
Back to Top