﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7018	Make ModelForm multiple inheritance possible	bear330	nobody	"If I have two ModelForm:

{{{

class AForm(ModelForm):
    class Meta:
        model = A

class BForm(ModelForm):
    class Meta:
        model = B

class CForm(AForm, BForm):
    pass
}}}


This doesn't work because of the code:

{{{
        declared_fields = get_declared_fields(bases, attrs, False)
}}}

in ModelFormMetaclass.

I can to this to make it work:


{{{
# Because ModelFormMetaclass will call get_declared_fields method with
# with_base_fields=False, we modify it with True.
from django.newforms import models as nmodels
gdf = nmodels.get_declared_fields
nmodels.get_declared_fields = \
    lambda bases, attrs, with_base_fields: gdf(bases, attrs, True)

}}}

But it will be nice if this behavior is default behavior.

Thanks.
        "	New feature	new	Forms	dev	Normal			robillard.etienne@… mmitar@… ciantic@… djsnickles@… semente+django@… Bouke Haarsma cyen0312+django@… maa@…	Accepted	0	0	0	0	0	0
