#7837: Hierarchy in forms metaclasses can miss declarated fields in forms
-----------------------------+----------------------------------------------
Reporter: msaelices | Owner: msaelices
Status: new | Milestone:
Component: django.newforms | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 1 |
-----------------------------+----------------------------------------------
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.
--
Ticket URL: <http://code.djangoproject.com/ticket/7837>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---