我無法弄清楚什麼是錯的,我收到以下錯誤:
< 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 %}
向我們展示POST模型的models.py代碼。 –
從django.db進口車型 類崗位(models.Model): 標題= models.CharField(MAX_LENGTH = 140) 體= models.TextField() 日期= models.DateTimeField() 高清__str __(自我): 返回self.title –