Opened 15 years ago

Closed 11 years ago

Last modified 11 years ago

#10239 closed New feature (fixed)

Document modelform_factory

Reported by: ingenieroariel Owned by: Tim Graham
Component: Documentation Version: dev
Severity: Normal Keywords: dceu2011
Cc: mbencun@… 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

Attachments (2)

ticket10239.patch (2.9 KB ) - added by Will Hardy 13 years ago.
Added documentation for modelform_factory
10239.diff (7.3 KB ) - added by Tim Graham 11 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 by Jacob, 15 years ago

Triage Stage: UnreviewedAccepted

I think modelform_factory is considered internal -- it's used by modelformset_factory -- and thus shouldn't be documented along with the public code. Nevertheless, in an idea world everything ought to be documented somewhere!

comment:2 by fas, 14 years ago

Cc: mbencun@… added

I didn't know it is considered internal, I use it very often. The formfield_callback to modify the form fields that are created for the corresponding db fields is in many cases much more useful/easier than defining the form field anew and pass all parameters explicitly (rather than having them being drawn from the model). The documentation also points out this shortcoming (Note box at http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets.

Any chance of making this method public?

comment:3 by Chris Beaven, 13 years ago

Severity: Normal
Summary: Document modelform_factoryDocument modelform_factory
Triage Stage: AcceptedDesign decision needed
Type: New feature

I'm going to push this back to a design decision and mark it as a feature (the feature being the addition of this method to the documented public forms API).

Bring a discussion to the django-dev group.

comment:4 by Will Hardy, 13 years ago

Easy pickings: unset
Owner: changed from nobody to Will Hardy
Status: newassigned
UI/UX: unset

by Will Hardy, 13 years ago

Attachment: ticket10239.patch added

Added documentation for modelform_factory

comment:5 by Will Hardy, 13 years ago

Has patch: set
Keywords: dceu2011 added
Owner: changed from Will Hardy to nobody
Status: assignednew

comment:6 by Peter van Kampen, 13 years ago

Thank you. This looks good. Would it make sense to include the function's signature in modelforms.txt?

comment:7 by Gabriel Hurley, 13 years ago

Patch needs improvement: set
Triage Stage: Design decision neededAccepted

While I can understand that this method may have been originally considered internal, I don't see any significant reason why it is more internal than modelformset_factory, which is documented. Additionally, I've certainly seen it in use by the community in numerous places. Changing it substantially in a backwards-incompatible way without documentation would be detrimental at this stage.

As for this patch, there's a significant typo on line 540: "modelformset_factory" should be "modelform_factory".

However, what really bothers is that the only documentation for ModelForm and modelformset_factory right now is in the topic guide. There direly needs to be a API reference for these in addition to just adding another section to the topic guide.

If this patch expands to include a reference doc (new) as well as the existing improvements then I'd be willing to commit it.

comment:8 by Tim Graham, 11 years ago

Owner: changed from nobody to Tim Graham

I'll add some reference docs to this.

by Tim Graham, 11 years ago

Attachment: 10239.diff added

comment:9 by Tim Graham, 11 years ago

Patch needs improvement: unset

Added an expanded patch with reference docs for modelform_factory and modelformset_factory.

comment:10 by Nick Sandford, 11 years ago

Triage Stage: AcceptedReady for checkin

The patch misses a newline after .. note:: on line 173. Other than that it looks good.

comment:11 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 71d76ec011b393990ba9f5fb63727dbe36c3c440:

Fixed #10239 - Added docs for modelform_factory

Thanks ingenieroariel for the suggestion and slurms for the review.

comment:12 by Tim Graham <timograham@…>, 11 years ago

In c94fcc4117987c4ebe29ad63da01035230c8afd5:

[1.5.x] Fixed #10239 - Added docs for modelform_factory

Thanks ingenieroariel for the suggestion and slurms for the review.

Backport of 71d76ec011 from master

comment:13 by Tim Graham <timograham@…>, 11 years ago

In c94fcc4117987c4ebe29ad63da01035230c8afd5:

[1.5.x] Fixed #10239 - Added docs for modelform_factory

Thanks ingenieroariel for the suggestion and slurms for the review.

Backport of 71d76ec011 from master

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