我刚刚将联系表单添加到我的应用程序中,然后在提交表单时返回了此表单。我的代码上没有blog_quotes
,并且在进行迁移时,没有任何变化。
ProgrammingError at /contact/
relation "blog_quotes" does not exist
LINE 1: INSERT INTO "blog_quotes" ("name", "email", "description") V...
^
Request Method: POST
Request URL: https://myapp.herokuapp.com/contact/
Django Version: 2.1.9
Exception Type: ProgrammingError
Exception Value:
relation "blog_quotes" does not exist
LINE 1: INSERT INTO "blog_quotes" ("name", "email", "description") V...
^
Exception Location: /app/.heroku/python/lib/python3.6/site- packages/django/db/backends/utils.py in _execute, line 85
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.6.8
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python36.zip',
'/app/.heroku/python/lib/python3.6',
'/app/.heroku/python/lib/python3.6/lib-dynload',
'/app/.heroku/python/lib/python3.6/site-packages']
Server time: Sun, 16 Jun 2019 23:57:25 +0800
这是我的表格。py
from django import forms
from django.forms import ModelForm
from .models import Contact
class ContactForm(ModelForm):
required_css_class = 'required'
class Meta:
model = Contact
fields = [
'name', 'email', 'description',
]
我的models.py
class Contact(models.Model):
name = models.CharField(max_length=100)
email = models.EmailField()
description = models.TextField()
def __str__(self):
return str(self.id)
class Meta:
verbose_name = "contact"
verbose_name_plural = "contacts"
我想念什么?
答案 0 :(得分:0)
如果这是一个开始的项目,则可以尝试将所有迁移重置为零,删除迁移文件,重新创建并重新运行它们。