﻿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
5693	ForeignKey + edit_inline + primary_key breaks django	andraz@…	nobody	"ForeignKey + edit_inline + primary_key breaks django.

Testcase:
class DjangoX(models.Model):
        id = models.AutoField(primary_key=True)
        str1 = models.CharField(max_length = 10)
        class Admin:
                pass

class DjangoY(models.Model):
        article = models.ForeignKey(    DjangoX,
                                        unique=True,
                                        edit_inline=models.STACKED,
                                        num_in_admin=1,
                                        min_num_in_admin=1,
                                        max_num_in_admin=1,  
                                        num_extra_on_change=0,
                                        primary_key = True,   
                                        raw_id_admin = True)
        str2 = models.CharField(max_length = 10, core = True)
        class Admin:
                pass


Then go to admin, create new object DjangoX, str1 = ""something"", leave str2 empty. Then click ""edit"" again and just press save.

You get KeyError:
KeyError at /admin/tee/djangox/1/
'article'
Request Method: 	POST
Request URL: 	http://localhost:8000/admin/tee/djangox/1/
Exception Type: 	KeyError
Exception Value: 	'article'
Exception Location: 	/home/minmax/zdev/django/db/models/manipulators.py in save, line 166
Python Executable: 	/usr/bin/python
Python Version: 	2.4.4


Version: 0.97-pre-SVN-6456, this is the first version tested, i haven't tried if it works in 0.96

"		closed	Uncategorized	dev		duplicate			Unreviewed	0	0	0	0	0	0
