Code

Opened 7 years ago

Closed 7 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:

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.

Attachments (0)

Change History (2)

comment:1 Changed 7 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 7 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.