Let's say I have the following model MyModel
(it is just an example; the real version has hundreds of fields):
class MyModel(models.Model):
date1 = models.DateField()
date2 = models.DateField()
date3 = models.DateField()
When I am saving the model, I get the following error:
ValidationError: ["'' value has an invalid date format. It must be in YYYY-MM-DD format."]
Basically, one of the fields received an empty string as opposed to a proper date format. However, I don't know whether date1
, date2
, or date3
is causing the problem.
Is there some easy way to check which field returned this ValidationError
?