Opened 2 months ago

Last modified 6 weeks ago

#35831 assigned Cleanup/optimization

Include ModelForm and its Meta options in reference docs

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

Description

ModelForm and the use and structure of a Meta inner class to control what it outputs is covered mostly by way of a topic, Creating Forms from Models.

As a developer, it would be helpful to be able to have a consolidated reference for the complete set of possible Meta options (ModelFormOptions) that can be used with a ModelForm's Meta class in a single place, rather than having to infer options from other topics or check the Python source.

Change History (7)

comment:1 by jernwerber, 2 months ago

Owner: set to jernwerber
Status: newassigned

comment:2 by Clifford Gama, 2 months ago

Triage Stage: UnreviewedAccepted

Hi @jernwerber, and thanks for taking the time to create this ticket.

I agree. The reference for ModelForm and the Meta options should be here. Although I'm not sure how much we should include there given most of the information is covered in the topic. I think we should start with the signatures, descriptions and the list of Meta options along with what they do.

Last edited 2 months ago by Clifford Gama (previous) (diff)

comment:3 by Clifford Gama, 2 months ago

Summary: Reference page for ModelForm Meta and ModelFormOptionsInclude ModelForm and its Meta options in reference docs

in reply to:  2 comment:4 by jernwerber, 2 months ago

Yep, that makes sense. I've structured by going through the possible/valid attributes for ModelFormOptions and detailing what each would accept/expect and the kinds of errors one might expect to see if something goes wrong.

I wasn't sure where to situate it in the docs since "models.txt" is already taken by the modelform_factory and modelformset_factory docs so for now I just put it under its own thing.

I've done a first pass, here: https://github.com/jernwerber/django/blob/docs-modelform-meta/docs/ref/forms/modelform-meta.txt, but before doing some of the formatting (like breaking lines at 80 characters) and making a PR, is there a (non-PR) workflow for this to be reviewed?

EDIT: I've instead submitted this as a draft PR (see comment below).

Replying to Clifford Gama:

Hi @jernwerber, and thanks for taking the time to create this ticket.

I agree. The reference for ModelForm and the Meta options should be here. Although I'm not sure how much we should include there given most of the information is covered in the topic. I think we should start with the signatures, descriptions and the list of Meta options along with what they do.

Last edited 2 months ago by jernwerber (previous) (diff)

comment:5 by jernwerber, 2 months ago

Has patch: set

I have created a draft PR for these changes: PR

Note: There is still a make warning because I have not added this to any toctrees. Not sure where it should go since the most relevant location is already taken by another ModelForms topic-- I wasn't sure if I could make the call to move things around.

comment:6 by Clifford Gama, 2 months ago

Patch needs improvement: set

comment:7 by jernwerber, 6 weeks ago

Patch needs improvement: unset
Note: See TracTickets for help on using tickets.
Back to Top