Let's say I have a CarModel(models.Model)
that uses price = models.DecimalField()
:
import CarModel
car = CarModel(name='Corvette', price='Hello World')
Traceback (most recent call last):
...
ValidationError: 'price needs to be a Decimal()'
The error was basically that.
Since the price was expecting a decimal but received a string, it raises a ValidationError immediately.
I was expecting it to work like this:
car = CarModel(name='Corvette', price='Hello World')
car.full_clean()
Traceback (most recent call last):
...
ValidationError: 'price needs to be a Decimal()'
Im I thinking about this correctly? Does it seem like ValidationError should only be raised on save() or by explicitly calling full_clean()?