Django: Field Error Unknown fields
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)
Try
fields = ('message',)
To create a tuple with only one element.
精彩评论