尝试在文章的管理面板中添加DateTimeField
Exception Type: OperationalError
Exception Value: no such column: blog_article.date
Admin.py
from django.contrib import admin
from blog.models import Article
class ArticleAdmin(admin.ModelAdmin):
list_display = ('title', 'date')
admin.site.register(Article, ArticleAdmin)
Models.py
from django.contrib.auth.models import User
from django.db import models
class Article(models.Model):
title = models.CharField(max_length=200)
text = models.TextField("Text")
date = models.DateField()
user = models.ForeignKey(User)
答案 0 :(得分:0)
在终端中尝试此命令:
替代: 排除位于文件夹/ migrations /中的迁移,然后重新进行迁移。