diff options
| author | Tim Graham <timograham@gmail.com> | 2015-07-24 07:51:40 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-08-10 11:31:22 -0400 |
| commit | e4b813c0e723e774c5c7386a29f10bc807a47e47 (patch) | |
| tree | 73de58298b124801d32e090661ab241e39c14039 /docs/ref | |
| parent | 90c7078f48fd6588fec905a29df8838714decc1e (diff) | |
[1.8.x] Fixed #25160 -- Moved unsaved model instance data loss check to Model.save()
This mostly reverts 5643a3b51be338196d0b292d5626ad43648448d3 and
81e1a35c364e5353d2bf99368ad30a4184fbb653.
Thanks Carl Meyer for review.
Backport of 5980b05c1fad69eef907e0076aa2dc837edab529 from master
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/contenttypes.txt | 7 | ||||
| -rw-r--r-- | docs/ref/models/fields.txt | 30 |
2 files changed, 0 insertions, 37 deletions
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt index 7dce890b15..510c6b2dc4 100644 --- a/docs/ref/contrib/contenttypes.txt +++ b/docs/ref/contrib/contenttypes.txt @@ -299,13 +299,6 @@ model: is ``True``. This mirrors the ``for_concrete_model`` argument to :meth:`~django.contrib.contenttypes.models.ContentTypeManager.get_for_model`. - .. attribute:: GenericForeignKey.allow_unsaved_instance_assignment - - .. versionadded:: 1.8 - - Works analogously to :attr:`ForeignKey.allow_unsaved_instance_assignment - <django.db.models.ForeignKey.allow_unsaved_instance_assignment>`. - .. deprecated:: 1.7 This class used to be defined in ``django.contrib.contenttypes.generic``. diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 8f66fc5a53..7e2bde56c3 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -1349,30 +1349,6 @@ The possible values for :attr:`~ForeignKey.on_delete` are found in If in doubt, leave it to its default of ``True``. -.. attribute:: ForeignKey.allow_unsaved_instance_assignment - - .. versionadded:: 1.8 - - This flag was added for backwards compatibility as older versions of - Django always allowed assigning unsaved model instances. - - Django prevents unsaved model instances from being assigned to a - ``ForeignKey`` field to prevent accidental data loss (unsaved foreign keys - are silently ignored when saving a model instance). - - If you require allowing the assignment of unsaved instances and aren't - concerned about the data loss possibility (e.g. you never save the objects - to the database), you can disable this check by creating a subclass of the - field class and setting its ``allow_unsaved_instance_assignment`` attribute - to ``True``. For example:: - - class UnsavedForeignKey(models.ForeignKey): - # A ForeignKey which can point to an unsaved object - allow_unsaved_instance_assignment = True - - class Book(models.Model): - author = UnsavedForeignKey(Author) - .. _ref-manytomany: ``ManyToManyField`` @@ -1575,12 +1551,6 @@ that control how the relationship functions. If in doubt, leave it to its default of ``True``. -.. attribute:: ManyToManyField.allow_unsaved_instance_assignment - - .. versionadded:: 1.8 - - Works analogously to :attr:`ForeignKey.allow_unsaved_instance_assignment`. - :class:`ManyToManyField` does not support :attr:`~Field.validators`. :attr:`~Field.null` has no effect since there is no way to require a |
