1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #10811 -- Made assigning unsaved objects to FK, O2O, and GFK raise ValueError.

This prevents silent data loss.

Thanks Aymeric Augustin for the initial patch and Loic Bistuer for the review.
This commit is contained in:
Anubhav Joshi
2014-05-19 14:15:55 +05:30
committed by Tim Graham
parent 4f72e5f03a
commit 5643a3b51b
12 changed files with 141 additions and 76 deletions

View File

@@ -96,11 +96,6 @@ class OneToOneRegressionTests(TestCase):
r = Restaurant(place=p)
self.assertTrue(r.place is p)
# Creation using keyword argument and unsaved related instance (#8070).
p = Place()
r = Restaurant(place=p)
self.assertTrue(r.place is p)
# Creation using attname keyword argument and an id will cause the related
# object to be fetched.
p = Place.objects.get(name="Demon Dogs")