﻿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
2421	Error editing object in admin when it is the foreign key of another model twice, one of which is edited inline	medhat	Adrian Holovaty	"I will describe it by way of an example:

start with the following models:

{{{
class model_a(models.Model):
    title = models.CharField(maxlength=100)
    
    class Admin:
        pass
        
class model_b(models.Model):
    title = models.CharField(maxlength=100,core=True)
    fk1 = models.ForeignKey(model_a,edit_inline=models.TABULAR)
    fk2 = models.ForeignKey(model_a,related_name='other')
    
    class Admin:
        pass                
}}}

Notice that model_b has two fields that are foreign keys to the same model. Also, one of these foreign keys is edited inline. If you try to edit or add a model_a object in the admin side you will get a !KeyError exception."	defect	closed	contrib.admin	dev	normal	duplicate			Unreviewed	0	0	0	0	0	0
