﻿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
7837	Hierarchy in forms metaclasses can miss declarated fields in forms	Manuel Saelices	Manuel Saelices	"This was occurs after [7847]. Ok, [7847] is a good commit for make able to metaclass subclassing.

This is the scenary:

{{{
#!python
#### model
class FooModel(models.Model):
    name = models.CharField(max_length=100)

#### forms
class GenericForm(forms.Form):
    extra_field = forms.CharField()

class FooForm(GenericForm, forms.ModelForm):
    # to avoid python metaclass conflict error:
    __metaclass__ = type('FooFormMetaclass', (GenericForm.__metaclass__, forms.ModelForm.__metaclass__), {})
    non_existing_field = forms.CharField()

    class Meta:
        model = FooModel
}}}

In previous scenario, {{{FooForm}}} should contain both {{{name}}}, {{{extra_field}}} and {{{nonexisting_field}}}. But only appears {{{name}}} field in {{{base_fields}}}.

See this test:
{{{
#!python
>>> from testapp.forms import FooForm
>>> FooForm.base_fields.keys()
['name']
}}}

I will attach a patch thats fixes problem."	Bug	closed	Forms	dev	Normal	fixed			Accepted	1	0	0	1	0	0
