+# HACK until http://code.djangoproject.com/ticket/14082 is resolved.
+_old = ModelFormMetaclass.__new__
+def _new(cls, name, bases, attrs):
+ if cls == ModelFormMetaclass:
+ m = attrs.get('__metaclass__', None)
+ if m is None:
+ parents = [b for b in bases if issubclass(b, ModelForm)]
+ for c in parents:
+ if c.__metaclass__ != ModelFormMetaclass:
+ m = c.__metaclass__
+ break
+
+ if m is not None:
+ return m(name, bases, attrs)
+
+ return _old(cls, name, bases, attrs)
+ModelFormMetaclass.__new__ = staticmethod(_new)
+# END HACK
+
+