Django:字段错误未知字段
我刚刚安装了 OS X Lion,所以我必须重新安装 Python2.7 的所有内容。为此,我将 Django 从 1.2.3 升级到了 1.3。当我尝试运行服务器时,我收到一个奇怪的字段错误,我很难破译该错误。
FieldError at /
Unknown field(s) (a, m, s, e, g) specified for Note
这是模型和形式:
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)
I just installed OS X Lion, so I had to reinstall everything for Python2.7. In doing that I upgraded my Django to 1.3 from 1.2.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:
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
创建一个只有一个元素的元组。
Try
To create a tuple with only one element.