[英]Django: Field Error Unknown fields
I just installed OS X Lion, so I had to reinstall everything for Python2.7.我刚刚安装了 OS X Lion,所以我不得不重新安装 Python2.7 的所有内容。 In doing that I upgraded my Django to 1.3 from 1.2.3.
为此,我将 Django 从 1.2.3 升级到 1.3。 When I try and runserver, I get an odd field error that I'm having a tough time deciphering.
当我尝试运行服务器时,我收到一个奇怪的字段错误,我很难破译。
FieldError at /
Unknown field(s) (a, m, s, e, g) specified for Note
Here is that Model & Form:这是 Model 和表格:
class Note(models.Model):
pub_date = models.DateTimeField(default=datetime.now,
auto_now_add=True, db_index=True)
user = models.ForeignKey(User, null=True, blank=True, related_name="writers")
to = models.ForeignKey(User, null=True, blank=True, related_name="tost")
message = models.CharField(default='', max_length=140)
active = models.BooleanField(default=True)
class NoteForm(forms.ModelForm):
class Meta:
model = Note
fields = ('message')
message = forms.CharField(
label=_("Sign the Guestbook"),
widget=forms.Textarea,
required=True)
Try尝试
fields = ('message',)
To create a tuple with only one element.创建一个只有一个元素的元组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.