Django.core.exceptions.ValidationError: ['“” value has an invalid date format. It must be in YYYY-MM-DD format.'] problem
In 'models.py' i have this fields.
first_name = models.CharField(max_length=30, null=True)
last_name = models.CharField(max_length=30, null=True)
date_of_brith = models.DateField(default='YYYY-MM-DD', null=True)
email = models.EmailField(max_length=50, null=True)
When i try to migrate. I get this error. I tryed to delete also the field and I still have the same error
django.core.exceptions.ValidationError: ['“” value has an invalid date format. It must be in YYYY-MM-DD format.']
instead of this:
date_of_brith = models.DateField(default='YYYY-MM-DD', null=True)
Try this:
import datetime
date_of_brith = models.DateField(default=datetime.date.today)
Note: it will display today's date as default
Do migrations manually using below command:
python manage.py makemigrations appname
python manage.py sqlmigrate appname 0001 #Value like this will generate automatically after makemigrations
python manage.py migrate