Opened 111 minutes ago
#37186 new Cleanup/optimization
Document form Field's template_name argument
| Reported by: | Tim Schilling | Owned by: | |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Normal | Keywords: | form rendering |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
The change to support form field rendering in Ticket #34077 stopped short of documenting that a field can have a customized template specified on the field itself. This template would be passed to the BoundField which we have public documentation for.
This change would mean documenting template_name in the Field.__init__ method here.
I suppose one reason to not do this is if this particular API isn't something we want to commit to. I think since it hasn't changed in a few years, it appears stable.
The usage we'd want to make developers aware of is that they can do today:
class ProfileForm(forms.Form):
image = forms.ImageField(
template_name="my_forms/fields/image_with_preview.html"
)