﻿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
18638	Reverse OneToOne relationship does not save properly.	David Hatch	nobody	"When the reverse side of a one-to-one relationship is assigned to and the model is saved, the association is not properly written to the database.

Example:

Models:
{{{
class Tag(models.Model):
    data = models.OneToOneField(""Data"")

class Data(models.Model):
    pass
}}}

Run:
{{{
data = Data()
t = Tag.objects.create()
data.tag = t
data.save()
# refresh from db
data = Data.objects.get(pk=data.pk)
data.tag # raises DoesNotExist
}}}

Attached is a patch including a test case which illustrates this issue.
To run the test case cd to the tests directory then... 

{{{export PYTHONPATH=`pwd`:`pwd`/..; ./runtests.py --settings=test_sqlite one_to_one_regress}}}

'''test_reverse_one_to_one_save''' should fail."	New feature	closed	Database layer (models, ORM)	1.4	Normal	wontfix		David Hatch	Unreviewed	0	0	0	0	0	0
