mirror of
https://github.com/django/django.git
synced 2025-11-02 04:48:33 +00:00
Fixed #24495 -- Allowed unsaved model instance assignment check to be bypassed.
This commit is contained in:
parent
02d78bb1a8
commit
81e1a35c36
10 changed files with 136 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue