mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +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:
parent
4f72e5f03a
commit
5643a3b51b
12 changed files with 141 additions and 76 deletions
|
@ -30,6 +30,10 @@ class Restaurant(models.Model):
|
|||
return "%s the restaurant" % self.place.name
|
||||
|
||||
|
||||
class Bar(models.Model):
|
||||
place = models.OneToOneField(Place, null=True)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Waiter(models.Model):
|
||||
restaurant = models.ForeignKey(Restaurant)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue