Задать вопрос

Тел: +7 965 3737 888

554

Просмотров

2

Ответов

Multiple inheritance of newforms and modelforms

If you try to use multiple inheritance with a modelform (to mix in some fields from an already existing form class for example) you'll get the following rather terrifying error:

"Error when calling the metaclass bases metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases"

The solution is to first create the ModelForm, then create a NEW class that inherits from both the ModelForm and the form you want to mixin, then finally apply the recipe from here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/204197

Вопрос полезен? Да0/Нет0
file_2749.py(2.9Кб)
None

Ответы (2):

Ответchachra:03.04.2011
Ответ полезен? Да0/Нет0

same here. only 1 form displays?

Ответvisik7:01.06.2009
Ответ полезен? Да0/Нет0

I got only the first form to be displayed