我正在尝试在添加到我的项目中的新应用中创建新表..makemigrations效果很好,但是migrate不起作用..这是我的模型
博客/models.py
from django.db import models
# Create your models here.
from fostania_web_app.models import UserModel
class Tag(models.Model):
tag_name = models.CharField(max_length=250)
def __str__(self):
return self.tag_name
class BlogPost(models.Model):
post_title = models.CharField(max_length=250)
post_message = models.CharField(max_length=2000)
post_author = models.ForeignKey(UserModel, on_delete=models.PROTECT)
post_image = models.ImageField(upload_to='documents/%Y/%m/%d', null=False, blank=False)
post_tag = models.ForeignKey(Tag, on_delete=models.PROTECT)
post_created_at = models.DateTimeField(auto_now=True)
当我尝试执行python manage.py migrate此操作时出现此错误
invalid literal for int() with base 10: '??????? ???????'
UserModel是在同一项目的另一个应用程序中创建的,这就是我使用该语句的原因from fostania_web_app.models import UserModel
青春有我
相关分类