Opened 5 years ago

Closed 4 years ago

#21319 closed Cleanup/optimization (fixed)

Document self.fields in forms

Reported by: Daniel Greenfeld Owned by: Vajrasky Kok
Component: Documentation Version: master
Severity: Normal Keywords: forms
Cc: loic@…, sky.kok@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


Instantiated django.forms.Form and django.forms.ModelForm classes have a fields attribute, which is an iterable of the form fields. It's clearly part of the stable API I don't believe it's documented. As it's a critical part of many complex solutions using forms, I think it would be a great addition to the documentation.

Change History (5)

comment:1 Changed 5 years ago by Tim Graham

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Yes, please.

comment:2 Changed 5 years ago by Marc Tamlyn

While we are there - I've seen a number of people struggle with the difference between form.fields and form.base_fields - we should explain what they are (and why you shouldn't mess around with the latter).

comment:3 Changed 5 years ago by loic84

Cc: loic@… added

comment:4 Changed 5 years ago by Vajrasky Kok

Cc: sky.kok@… added
Easy pickings: set
Has patch: set
Owner: changed from nobody to Vajrasky Kok
Status: newassigned
Version: 1.4master

comment:5 Changed 4 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In ea83102d0f0c215ae2bd16a2c8c474ce615bad9a:

Fixed #21319 -- Added documentation for the Form.fields attribute.

Thanks pydanny for the report. Also, added documentation about
base_fields attribute and its difference with fields attribute.

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