﻿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
22726	Prevent setting nullable relations on unsaved objects	Vlastimil Zíma	nobody	"Dispute on resolution of #18153 and #19089.

Assume you have models `Place` and `UndergroundBar` with nullable one-to-one relation to the place, as in `one_to_one_regress` tests models.

Since Django 1.6 the one-to-one relation on unsaved objects became asymmetric. You could set one-to-one relation, but not the reverse one-to-one relation, even though setting forward relation sets the cache for reverse relation.

Example:
{{{
#!python
place = Place()
bar = UndergroundBar()

place.undergroundbar = bar # Raises error
# But
bar.place = place
place.undergroundbar # Returns 'bar'
}}}

I attach patch with fix and modification of regression test `test_set_reverse_on_unsaved_object`. I have not found any other problems which should prevent relations between unsaved objects, especially because they can be created anyway."	Bug	closed	Database layer (models, ORM)	1.6	Normal	duplicate			Accepted	0	0	0	0	0	0
