﻿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
3849	Saving edit_inline OneToOneField is broken in admin	Ilya Semenov <semenov@…	nobody	"Consider the following model:
{{{
class UserProfile(models.Model):
    user = OneToOneField(User, edit_inline=models.TABULAR)
    data = models.CharField(maxlength=255, core=True)
}}}

Saving a user object in admin interface produces the following error:
{{{
Traceback (most recent call last):
 
  File ""/usr/lib/python2.4/site-packages/django/core/handlers/base.py"", line 77, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
 
  File ""/usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py"", line 55, in _checklogin
    return view_func(request, *args, **kwargs)
 
  File ""/usr/lib/python2.4/site-packages/django/views/decorators/cache.py"", line 39, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
 
  File ""/usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py"", line 329, in change_stage
    new_object = manipulator.save(new_data)
 
  File ""/usr/lib/python2.4/site-packages/django/db/models/manipulators.py"", line 165, in save
    if rel_new_data[related.opts.pk.name][0]:
 
KeyError: 'user'
}}}

Note: this is '''not''' the problem with OneToOneField related object not created. The related object already exists in the database.

I know this ticket will probably be considered ""invalid"" in favour of upcoming admin rewrite, but I'm still going to submit the patch (against revision [4835]) for those who don't have time to wait for the new admin and just want their system working."		closed	Database layer (models, ORM)	dev		duplicate	OneToOneField admin edit_inline		Unreviewed	1	0	0	0	0	0
