Code

Opened 9 months ago

Closed 6 months ago

#21319 closed Cleanup/optimization (fixed)

Document self.fields in forms

Reported by: pydanny Owned by: vajrasky
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

Description

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.

Attachments (0)

Change History (5)

comment:1 Changed 9 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

Yes, please.

comment:2 Changed 9 months ago by mjtamlyn

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 7 months ago by loic84

  • Cc loic@… added

comment:4 Changed 7 months ago by vajrasky

  • Cc sky.kok@… added
  • Easy pickings set
  • Has patch set
  • Owner changed from nobody to vajrasky
  • Status changed from new to assigned
  • Version changed from 1.4 to master

comment:5 Changed 6 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

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.

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.