Code

Opened 18 months ago

Closed 18 months ago

Last modified 17 months ago

#19640 closed Cleanup/optimization (fixed)

inlineformset_factory is not documented well like other formset_factories

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

Description

inlineformset_factory is poorly documented.

https://docs.djangoproject.com/en/dev/ref/forms/models/#django.forms.models.modelformset_factory
lists modelform_factory and modelformset_factory, but not inlineformset_factory.

We should probably add something in the line of:

inlineformset_factory(parent_model, model, form=ModelForm, formfield_callback=None, formset=BaseInlineFormSet, fk_name=None, extra=3, can_delete=True, can_order=False, max_num=None, fields=None, exclude=None)

Note that inlineformset_factory uses modelformset_factory() and marks can_delete=True, extra=3. In addition, it uses BaseInlineFormSet by default.
If your model has more than one ForeignKey to the parent_model, you must specify a fk_name.

Attachments (1)

19640.diff (1.9 KB) - added by timo 18 months ago.

Download all attachments as: .zip

Change History (5)

Changed 18 months ago by timo

comment:1 Changed 18 months ago by timo

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 18 months ago by Tim Graham <timograham@…>

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

In 5b2d9bacd2512bcdf371c05b0b43bc713dcca080:

Fixed #19640 - Added inlineformset_factory to reference docs.

Thanks wim@ for the suggestion.

comment:3 Changed 18 months ago by Tim Graham <timograham@…>

In 34718395edec9aaf01443b7c9d89ebe14400721e:

[1.5.x] Fixed #19640 - Added inlineformset_factory to reference docs.

Thanks wim@ for the suggestion.

Backport of 5b2d9bacd2 from master

comment:4 Changed 17 months ago by Tim Graham <timograham@…>

In 34718395edec9aaf01443b7c9d89ebe14400721e:

[1.5.x] Fixed #19640 - Added inlineformset_factory to reference docs.

Thanks wim@ for the suggestion.

Backport of 5b2d9bacd2 from master

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.