Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#24255 closed Bug (fixed)

modelformset_factory examples in documentation do not specify a field list

Reported by: Matt Westcott Owned by: Matt Westcott
Component: Documentation Version: master
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

Several of the examples for modelformset_factory in the documentation now fail in Django 1.8, because they do not pass a 'fields' or 'exclude' parameter (either directly to the modelformset_factory function, or indirectly by specifying a ModelForm subclass).

For example: https://github.com/django/django/blob/a15aba66f2fc650f70a791fb7fa880cf85cb1229/docs/topics/forms/modelforms.txt#L717

>>> from django.forms.models import modelformset_factory
>>> from myapp.models import Author
>>> AuthorFormSet = modelformset_factory(Author)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/matthew/.virtualenvs/dj18/lib/python2.7/site-packages/django/forms/models.py", line 827, in modelformset_factory
    "Calling modelformset_factory without defining 'fields' or "
ImproperlyConfigured: Calling modelformset_factory without defining 'fields' or 'exclude' explicitly is prohibited.

Change History (5)

comment:1 Changed 5 years ago by Matt Westcott

Owner: changed from nobody to Matt Westcott
Status: newassigned

comment:2 Changed 5 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:3 Changed 5 years ago by Matt Westcott

Has patch: set

PR: https://github.com/django/django/pull/4024

I've slightly reshuffled the docs to explain the 'fields' / 'exclude' parameters up-front, rather than in their own section. (I also fixed a reference in the ModelForm docs which was wrongly pointing to that now-deleted section.)

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

Resolution: fixed
Status: assignedclosed

In 8d64aae883f7721c33f88276e7c999844085659f:

Fixed #24255 -- Specifed 'fields' parameter in modelformset_factory / inlineformset_factory examples.

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

In ef90ca5f42c81dcee39878c9da96af56eb5e29a4:

[1.8.x] Fixed #24255 -- Specifed 'fields' parameter in modelformset_factory / inlineformset_factory examples.

Backport of 8d64aae883f7721c33f88276e7c999844085659f from master

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