Hello everyone!
When I was editing django's model.py, I accidentally copied a field type incorrectly:
rdc_mysql = models.DateField(verbose_name='数据库版本',max_length=50,blank=True,null=True,default='Mysql5.6')
Later, when I logged in to the web page, I found that it was like this.
Since the format is wrong, I returned to model.py and manually changed the Datefield to charfield, as follows:
rdc_mysql = models.CharField(verbose_name='数据库版本',max_length=50,default='Mysql5.6')
Save and exit, but when executing python manage.py migrate, an error is reported:
django.core.exceptions.ValidationError: [u"'Mysql5.6' value has an invalid date format. It must be in YYYY-MM-DD format."]
What else do I need to do?
The error message says that the fields in default must be in the format of "YYYY-MM-DD".
I took a look in the database. Although my model.py has changed, the things in the database have not changed. In other words, python manager.py makemigrations has not changed the table structure in mysql. Is it now only possible through mysql? Can it be changed inside, but cannot be changed through Django statements?