mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +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:
committed by
Marc Tamlyn
parent
3bd45ba00d
commit
819e09b848
@@ -48,6 +48,9 @@ class Whiz(models.Model):
|
||||
class BigD(models.Model):
|
||||
d = models.DecimalField(max_digits=38, decimal_places=30)
|
||||
|
||||
class FloatModel(models.Model):
|
||||
size = models.FloatField()
|
||||
|
||||
|
||||
class BigS(models.Model):
|
||||
s = models.SlugField(max_length=255)
|
||||
|
||||
Reference in New Issue
Block a user