﻿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
11097	Formset documentation should include a note about form.blah_ptr for derived models	Andriy Drozdyuk	Mac Chapman	"Whenever a model inherits from a non-abstract model, it shares it's primary key with it.
As a consequence, the form produced by inlineformset_factory no longer has id field, by the ""parentname_ptr"" field.

For example imagine you have a case such as:


{{{
class Car(models.Model):
    color = #string field

class BMW(Car):
    shop = models.ForeignKey(CarShop)
}}}


Then in our view:


{{{
car = BMW.objects.get(pk=1)
BMWFromset = inlineformset_factory(CarShop, BMW, 
                                can_delete=True,
				extra=1)
formset = BMWFormset(instance=car)
}}}


The in our html:

{{{
<form method=""post"">
{{formset.management_form}}
<ul>
	{% for form in formset.forms %}
	
        <li>
        <!-- NOTICE that we do NOT use form.id here -->
        {{form.car_ptr}}
        {{form}}
        </li>
	
        {% endfor %}
</ul>
<input type=""submit""  value=""submit"" />
</form>
}}}
"	Cleanup/optimization	closed	Documentation	dev	Normal	fixed	formset, form, inheritance, id		Accepted	1	0	0	0	0	0
