﻿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
1603	Setting a primary key field editable=False breaks when using edit_inline	anonymous	nobody	"Setting a primary key field editable=False breaks inline editing. Given the following models:

{{{
#!python
class FooOne(models.Model):
    id = models.AutoField(primary_key=True, editable=False)
    foobar = models.CharField(maxlength=24, core=True)
    class Admin:
        pass

    def __repr__(self):
        return self.foobar

class FooMany(models.Model):
    id = models.AutoField(primary_key=True, editable=False)
    foo = models.CharField(maxlength=24, core=True)
    fooone = models.ForeignKey(FooOne, edit_inline=models.TABULAR)
    class Admin:
        pass

    def __repr__(self):
        return self.foo
}}}

When attempting to update an added FooOne entry via the admin interface, The following error occurs:

{{{
Traceback (most recent call last):
File ""/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/handlers/base.py"" in get_response
  73. response = callback(request, *callback_args, **callback_kwargs)
File ""/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/contrib/admin/views/decorators.py"" in _checklogin
  54. return view_func(request, *args, **kwargs)
File ""/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/views/decorators/cache.py"" in _wrapped_view_func
  40. response = view_func(request, *args, **kwargs)
File ""/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/contrib/admin/views/main.py"" in change_stage
  328. new_object = manipulator.save(new_data)
File ""/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/db/models/manipulators.py"" in save
  164. if rel_new_data[related.opts.pk.name][0]:

  KeyError at /admin/trak/fooone/1/
  'id'
}}}

The rel_new_data variable at this point contains:

{{{
#!python
{'foo': ['oof']}

}}}

Obviously, an 'id' key is expected. When I change the model of FooMany, so that the 'id' field is editable, I am able to update FooOne successfully via the admin interface."	defect	closed	contrib.admin	dev	normal	invalid	edit_inline	david@…	Accepted	0	0	0	0	0	0
