2017-03-04 125 views
0

enter image description here没有这样的列:blog_post.title

我无法弄清楚什么是错的,我收到以下错误:

< OperationalError at /blog/ no such column: blog_post.title Request Method: GET Request URL: http://127.0.0.1:8000/blog/ Django Version: 1.10.5 Exception Type: OperationalError Exception Value: no such column: blog_post.title Exception Location: C:\Users\Home\AppData\Local\Programs\Python\Python35- 32\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 337 Python Executable: C:\Users\Home\Desktop\Vmoney\Desktop\Scripts\mysite\python.exe Python Version: 3.5.2 Python Path:

这里是模板:

{% extends "personal/header.html" %} 
{% block content %} 
    {% for post in object_list %} 
     <h5>{{ post.date|date:"Y-m-d" }}<a href="/blog/{{post.id}}"> {{ post.title }}</a></h5> 
    {% endfor %} 
{% block content %} 

{% for post in object_list %} 
{{ post.date|date:"Y-m-d" }} 
{{ post.title }} 
{% endfor %} 
{% endblock %} 
+0

向我们展示POST模型的models.py代码。 –

+0

从django.db进口车型 类岗位(models.Model): 标题= models.CharField(MAX_LENGTH = 140) 体= models.TextField() 日期= models.DateTimeField() 高清__str __(自我): 返回self.title –

回答

2

你可能会忘记makemigrationsmigrate。 是这样做的:

python manage.py makemigrations 
python manage.py migrate