mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #22210 -- Saving model instances to non-related fields.
Previously, saving a model instance to a non-related field (in particular a FloatField) would silently convert the model to an Integer (the pk) and save it. This is undesirable behaviour, and likely to cause confusion so the validatio has been hardened. Thanks to @PirosB3 for the patch and @jarshwah for the review.
This commit is contained in:
parent
3bd45ba00d
commit
819e09b848
4 changed files with 27 additions and 2 deletions
|
@ -674,6 +674,10 @@ Models
|
|||
the new :attr:`ManyToManyField.through_fields <django.db.models.ManyToManyField.through_fields>`
|
||||
argument.
|
||||
|
||||
* Assigning a model instance to a non-relation field will now throw an error.
|
||||
Previously this used to work if the field accepted integers as input as it
|
||||
took the primary key.
|
||||
|
||||
Signals
|
||||
^^^^^^^
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue