Fixed #24495 -- Allowed unsaved model instance assignment check to be bypassed.

This commit is contained in:
Karl Hobley 2015-03-16 19:28:53 +00:00 committed by Tim Graham
parent 02d78bb1a8
commit 81e1a35c36
10 changed files with 136 additions and 5 deletions

View file

@ -60,6 +60,10 @@ raises ``ValueError``::
...
ValueError: 'Cannot assign "<Reporter: John Smith>": "Reporter" instance isn't saved in the database.'
If you want to disable the unsaved instance check, you can use the
:attr:`~django.db.models.ForeignKey.allow_unsaved_instance_assignment`
attribute.
.. versionchanged:: 1.8
Previously, assigning unsaved objects did not raise an error and could

View file

@ -101,6 +101,10 @@ raises ``ValueError``::
...
ValueError: 'Cannot assign "<Restaurant: Demon Dogs the restaurant>": "Restaurant" instance isn't saved in the database.'
If you want to disable the unsaved instance check, you can use the
:attr:`~django.db.models.ForeignKey.allow_unsaved_instance_assignment`
attribute.
.. versionchanged:: 1.8
Previously, assigning unsaved objects did not raise an error and could