Opened 18 years ago
Closed 18 years ago
#5759 closed (fixed)
[newforms-admin] inline_formset() doesn't allow customized forms
| Reported by: | Antti Kaihola | Owned by: | nobody |
|---|---|---|---|
| Component: | Forms | Version: | newforms-admin |
| Severity: | Keywords: | nfa-blocker | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
As described in the documentation, the form_for_model() and form_for_instance() functions accept a form= keyword argument for specifying a custom form as their base classes.
In the newforms-admin branch, the formset_for_model() function supports a similar form= keyword argument, but the inline_formset() function does not. It would be useful to have this functionality.
Attachments (2)
Change History (8)
by , 18 years ago
| Attachment: | inline_formset_form_kwarg.diff added |
|---|
comment:1 by , 18 years ago
Actually it would be useful to have the formset= keyword argument as well, i.e. to be able to view only a subset of the related objects.
by , 18 years ago
| Attachment: | 5759-inline_formset_extra_kwargs.diff added |
|---|
added the formset= kwarg, changed kwarg order
comment:2 by , 18 years ago
In the second patch I added the formset= kwarg and reordered keyword arguments in both inline_formset() and formset_for_model() to match those of functions further down the call stack. Might reduce confusion if someone wants to omit keywords and provide values as positional arguments.
comment:3 by , 18 years ago
| Patch needs improvement: | set |
|---|---|
| Triage Stage: | Unreviewed → Design decision needed |
This is generally a good idea, however, inline formsets will be changing before newforms-admin is considered complete. Will mark as DDN to see if this will be needed after some refactoring.
comment:4 by , 18 years ago
| Triage Stage: | Design decision needed → Accepted |
|---|
Ok, now since formset_for_queryset is in newforms-admin (r6655) this is now a very good idea.
comment:5 by , 18 years ago
| Keywords: | nfa-blocker added |
|---|
I firmly believe this needs to be included before a merge to trunk. It is actually blocking my ability to write a good patch for #5721. Tagging with nfa-blocker.
comment:6 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
This has been fixed with the new form class field in admin classes. Tested with StackedInline, works correctly.
simple patch to provide this functionality