日期字段存在于模型和数据库中,但仍显示错误为“(1054,”字段列表中的“未知列'日期'”)“我知道错误在哪里
form.py
from django import forms
from .models import feed
class feed_form(forms.ModelForm):
class Meta:
model = feed
fields = ('feed_text', )
views.py
def upload(request):
form = feed_form(data=request.POST)
feed_cont = form.save(commit=False)
feed_cont.user = User.objects.get(pk =1)
feed_cont.upvote = 0
feed_cont.downvote = 0
feed_cont.date = "hello"
feed_cont.save()
return render(request,'feeds/feeds.html')
models.py
class feed(models.Model):
user = models.ForeignKey(User,null=True,blank=True)
feed_text = models.CharField(max_length=2000)
date = models.CharField(max_length=30)
upvote = models.IntegerField(default=0)
downvote = models.IntegerField(default=0)
def __str__(self):
return feed.content
为什么会出现这个错误? 提前致谢