mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #25160 (again) -- Moved data loss check on reverse relations.
Moved data loss check when assigning to a reverse one-to-one relation on
an unsaved instance to Model.save(). This is exactly the same change as
e4b813c but for reverse relations.
This commit is contained in:
@@ -39,3 +39,7 @@ Bugfixes
|
||||
|
||||
* Fixed custom queryset chaining with ``values()`` and ``values_list()``
|
||||
(:ticket:`20625`).
|
||||
|
||||
* Moved the :ref:`unsaved model instance assignment data loss check
|
||||
<unsaved-model-instance-check-18>` on reverse relations to ``Model.save()``
|
||||
(:ticket:`25160`).
|
||||
|
||||
@@ -702,6 +702,9 @@ Assigning unsaved objects to relations raises an error
|
||||
...
|
||||
ValueError: save() prohibited to prevent data loss due to unsaved related object 'author'.
|
||||
|
||||
A similar check on assignment to reverse one-to-one relations was removed
|
||||
in Django 1.8.5.
|
||||
|
||||
Assigning unsaved objects to a :class:`~django.db.models.ForeignKey`,
|
||||
:class:`~django.contrib.contenttypes.fields.GenericForeignKey`, and
|
||||
:class:`~django.db.models.OneToOneField` now raises a :exc:`ValueError`.
|
||||
|
||||
Reference in New Issue
Block a user