I created a model for posts in Django and I'm trying to update one of the fields in the database (MySQL).
I have the following block of code:
model.py
class Post (models.Model):
title = models.CharField()
preamble = models.CharField()
body = models.TextField ()
createdAt = models.DateTimeField(auto_now_add=True, blank=True)
I want to add another field called author author=models.ForeignKey(User, on_delete=models.CASCADE
Also, I want to change the name of one of the fields from preamble
to introduction
Whenever I run the command python manage.py makemigrations
and then python manage.py migrate
, I get an error which terminates the migration process. it's telling me that the field preamble
which I have in my database is not recognized. Is it possible to update preamble
to introduction
?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…