Django: Field Error Unknown fields

Emile picture Emile · Jul 20, 2011 · Viewed 16.6k times · Source

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)

Answer

S.Lott picture S.Lott · Jul 20, 2011

Try

    fields = ('message',)

To create a tuple with only one element.