Opened 16 years ago

Closed 16 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: no UI/UX: no

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@…> 16 years ago.
patch for newforms/models.py

Download all attachments as: .zip

Change History (4)

by Christian Tanzer <tanzer@…>, 16 years ago

Attachment: models.diff added

patch for newforms/models.py

comment:1 by Malcolm Tredinnick, 16 years ago

(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 by Malcolm Tredinnick, 16 years ago

Has patch: set
Triage Stage: UnreviewedAccepted
Version: SVNnewforms-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 by Brian Rosner, 16 years ago

Resolution: fixed
Status: newclosed

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

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