Opened 17 years ago
Closed 17 years ago
#4616 closed (wontfix)
Widgets should be able to rendered separately
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | dev |
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: | no | UI/UX: | no |
Description
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 }}
</p>
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 by , 17 years ago
Summary: | Widget SplitDateTimeWidget and field SplitDateTimeField unusable → Widgets should be able to rendered separately |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → 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.
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 justSplitDateTimeWidget
andSplitDateTimeField
.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.