Code

Opened 6 years ago

Closed 6 years ago

#7617 closed (fixed)

ModelFormMetaclass.__new__ is incompatible with metaclass mixins

Reported by: Christian Tanzer <tanzer@…> Owned by: nobody
Component: Forms Version: newforms-admin
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I wanted to define a subclass of ModelFormMetaclass that also inherits from a mixin. Because new has an additional parameter formfield_callback, the call of the mixin's new fails.
In addition, ModelFormMetaclass.new doesn't use super(...).new in all cases.

I'll attach a patch fixing this.

Attachments (1)

models.diff (1.7 KB) - added by Christian Tanzer <tanzer@…> 6 years ago.
patch for newforms/models.py

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by Christian Tanzer <tanzer@…>

patch for newforms/models.py

comment:1 Changed 6 years ago by mtredinnick

(In [7847]) Changed ModelFormMetaclass to have the normal signature for a new method.
Allows extending the metaclass more normally.

Patch from Christian Tanzer. Refs #7617.

comment:2 Changed 6 years ago by mtredinnick

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from SVN to newforms-admin

Most of this patch was for trunk (and that went into [7847]), but there's a portion just at the end that patches from formclass stuff. That is newforms-admin territory, so moving to that branch for them to handle (and close when it's done). Basically, the call to ModelFormMetaclass.__new__() has to change slightly.

comment:3 Changed 6 years ago by brosner

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

(In [7854]) newforms-admin: Fixed #7617 -- Adjusted the call to ModelFormMetaclass.new in modelform_factory to work with the new signature introduced in [7847].

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.