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
8841,ModelChoiceIterator does not work with multi table inheritance,hmarr,nobody,"The bug appears in the child admin interface view, when you use multi table inheritance.
A !ForeignKey selectbox shows the output of !__unicode!__() from the parent object for select values instead of the PK.
Example:
{{{
}}}
instead of
{{{
}}}
We fixed it with the following code in django.forms.models.!ModelChoiceIterator:
{{{
def choice(self, obj):
if self.field.to_field_name:
try:
key = getattr(obj, self.field.to_field_name).pk
except AttributeError:
key = getattr(obj, self.field.to_field_name)
else:
key = obj.pk
return (key, self.field.label_from_instance(obj))
}}}",,closed,Forms,dev,,fixed,,Marc Remolt hmarr flosch,Accepted,1,0,1,0,0,0