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)
Change History (3)
by , 15 years ago
Attachment: | modelforms_change.diff added |
---|
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
A recommended documentation addition