Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19700 closed New feature (fixed)

BoundField documentation: original field

Reported by: tga Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Please add in the documentation a mention on how to get the original field of a BoundField.

Locations:
https://docs.djangoproject.com/en/dev/topics/forms/#looping-over-the-form-s-fields
https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.BoundField

In these two locations it would be very useful to have a mention like:

--

{{ field.field }}
The original field instance, as added to the form object, e.g. a forms.CharField instance.

--

Details:
When adding field programatically to a form, it comes naturally to want to add extra fields to that object and then read them back in the template. However, as the docs clearly state, iterating over a (bound) form returns BoundFields instead of the original Field objects put into the form. There is no mention in the docs how to get to the original field instance in the template.

Cheers!

Change History (4)

comment:2 by Tim Graham <timograham@…>, 12 years ago

Resolution: fixed
Status: newclosed

In fdaaa241715ece2f706041faf16fb282e2782593:

Fixed #19700 - Added documentation for BoundField.field.

Thanks Tiberiu Ana for the report and patch.

comment:3 by Tim Graham <timograham@…>, 12 years ago

In f28fbe7314712d3e594a0f6509361378162cc7ea:

[1.5.x] Fixed #19700 - Added documentation for BoundField.field.

Thanks Tiberiu Ana for the report and patch.

Backport of fdaaa24171 from master

comment:4 by Tim Graham <timograham@…>, 12 years ago

In f28fbe7314712d3e594a0f6509361378162cc7ea:

[1.5.x] Fixed #19700 - Added documentation for BoundField.field.

Thanks Tiberiu Ana for the report and patch.

Backport of fdaaa24171 from master

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