Code

Opened 7 years ago

Closed 6 years ago

#5759 closed (fixed)

[newforms-admin] inline_formset() doesn't allow customized forms

Reported by: akaihola 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: UI/UX:

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)

inline_formset_form_kwarg.diff (1.2 KB) - added by akaihola 7 years ago.
simple patch to provide this functionality
5759-inline_formset_extra_kwargs.diff (1.9 KB) - added by akaihola 7 years ago.
added the formset= kwarg, changed kwarg order

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by akaihola

simple patch to provide this functionality

comment:1 Changed 7 years ago by akaihola

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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.

Changed 7 years ago by akaihola

added the formset= kwarg, changed kwarg order

comment:2 Changed 7 years ago by akaihola

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 Changed 7 years ago by brosner

  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to 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 Changed 7 years ago by brosner

  • Triage Stage changed from Design decision needed to Accepted

Ok, now since formset_for_queryset is in newforms-admin (r6655) this is now a very good idea.

comment:5 Changed 7 years ago by brosner

  • 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 Changed 6 years ago by mrts

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

This has been fixed with the new form class field in admin classes. Tested with StackedInline, works correctly.

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.