question
Modify the Image table to add the attribute auto_now = True to the time field:
class Image(models.Model): id = models.CharField(max_length=36, primary_key=True) path = models.CharField(max_length=100) status = models.IntegerField(default=2) operator = models.CharField(max_length=20) time = models.DateTimeField(auto_now = True)
How does it work?
solve
The same as the method when the model was first created, it is divided into two steps:
python manage.py makemigrations app_label
Create the latest version of the model, then
python manage.py migrateApply all migrations.