Code

Opened 2 years ago

Closed 19 months ago

#18573 closed New feature (needsinfo)

formfield_callback attribute on ModelForm not being passed to modelform_factory

Reported by: django@… Owned by: nobody
Component: Forms Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Solitary ModelForm instances are run though ModelForm.formfield_callback() when they are instantiated. It would be nice if ModelForm instances generated from modelform_factory also did this without having to specify formfield_callback again when calling modelform_factory.

In effect:

    modelform_factory(
        model=AModel,
        form=AModelForm,
        formfield_callback=AModelForm.formfield_callback if hasattr(AModelForm, 'formfield_callback') else None
        )

I am not entirely sure of the terminology. I'm happy to explain further if need be.

Attachments (1)

0001-test-default-formfield_callback.patch (1.7 KB) - added by tuxcanfly 19 months ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 21 months ago by lrekucki

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

Changed 19 months ago by tuxcanfly

comment:2 Changed 19 months ago by tuxcanfly

This works as expected on trunk, if I'm not missing anything. Added test.

comment:3 Changed 19 months ago by claudep

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

The test also passes on 1.3 and 1.4 branches. Paul, I think it's now your turn to show us the real issue, in the case we misunderstood it.

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.