Opened 15 years ago

Closed 15 years ago

#11755 closed (fixed)

Django documentation on Model FormSets should include a tip on how to override default behavior

Reported by: ffualo Owned by: nobody
Component: Documentation Version: 1.1
Severity: Keywords: modelformset_factory
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The documentation page "Creating forms from models" mentions:

"By default, when you create a formset from a model, the formset will use a queryset that includes all objects in the model (e.g., Author.objects.all()). You can override this behavior by using the queryset argument"

However, it does not mention how to override this behavior, which is useful when you want to print blank form fields in a template. This is done with

AuthorFormSet(queryset=Author.objects.none())

This issue was discussed on #django.

Attachments (1)

modelforms_change.diff (676 bytes ) - added by ffualo 15 years ago.
A recommended documentation addition

Download all attachments as: .zip

Change History (3)

by ffualo, 15 years ago

Attachment: modelforms_change.diff added

A recommended documentation addition

comment:1 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedReady for checkin

comment:2 by Russell Keith-Magee, 15 years ago

Resolution: fixed
Status: newclosed

(In [11549]) Fixed #11755 -- Added documentation for an edge case of FormSet usage. Thanks to ffualo for the suggestion.

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