﻿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
3815	form_for_* methods should be able to use a Form superclass	jon.i.austin@…	nobody	"hi,

I'm not sure if this is a bug or not, but according to the newforms docs, one should be able to subclass an existing form class and add fields to it.
This works just fine if the ancestor form class is explicitly defined in the code.

However if one creates a new Form class using newforms.form_for_model(MyModelClass) and tries to subclass the resulting class it doesn't work.
i.e. using the Polls model from the tutorial:

{{{
from polls import models
from django.newforms import form_for_model
PollForm = form_for_model(models.Poll)

class PollFormWithTest(PollForm):
   ....:     test = charField()

testPollWithTest = PollFormWithTest()

print testPollWithTest.fields
{'question': <django.newforms.fields.CharField object at 0xb745b62c>, 'pub_date': <django.newforms.fields.DateTimeField object at 0xb745b58c>}

print testPollWithTest.test
<django.newforms.fields.CharField object at 0xb745b52c>
}}}

as you can see test is added as an base attribute to the instance, not as a field.

Is this perhaps because the PollForm is an instance of a class and not an actual class definition? 
If so is there a way around this, and could it perhaps be added to the docs?

Also: if the above is the case the docstring for newforms.form_for_model should probably be changed:[[BR]]
Returns a Form class for the given Django model class.[[BR]]
to: s/a Form class/an instance of a Form class/

thanks!

jon
"		closed	Forms	dev		wontfix	newforms		Accepted	1	0	0	0	0	0
