Simon Meers
unread,Feb 9, 2010, 7:21:07 PM2/9/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
This may be a python quirk I'm unaware of, or perhaps a Django bug, I'm not sure:
#------------------------------------------------------------
# forms.py:
#------------------------------------------------------------
from django import forms
class TestForm(forms.Form):
test_field = forms.BooleanField()
#------------------------------------------------------------
#------------------------------------------------------------
# test.py:
#------------------------------------------------------------
# import the same class from two different locations:
from project_name.forms import TestForm
from project_name.some_module.forms import TestForm as TestForm2
class MyForm(TestForm):
extra_field = forms.BooleanField()
print MyForm().fields.keys()
# prints: ['test_field', 'extra_field'] as expected
class MyForm2(TestForm2):
extra_field = forms.BooleanField()
print MyForm2().fields.keys()
# prints: ['test_field']
# extra fields not registered if superclass imported from other app/module!
#------------------------------------------------------------
Python 2.6.4, Django SVN-12401
What is going on here?
Simon