I have coded a table which looks like this:
class Comment(models.Model):
title = models.CharField(max_length=1,choices=TITLE_CHOICES)
firstname = models.CharField(max_length=15)
lastname = models.CharField(max_length=25)
commenttext = models.CharField(max_length=500)
emailaddress = models.CharField(max_length=30)
commentdate = models.DateTimeField()
and when I try to save a new entry to it like this:
newtitle = form.cleaned_data['title']
newfirstname = form.cleaned_data['firstname']
newlastname = form.cleaned_data['lastname']
newcommenttext = form.cleaned_data['commenttext']
newemailaddress = form.cleaned_data['emailaddress']
newcommentdate = form.cleaned_data['commentdate']
newcomment = Comment(title=newtitle,
firstname=newfirstname, lastname=newlastname,
commenttext=newcommenttext, emailaddress=newemailaddress,
commentdate=newcommentdate)
newcomment.save()
I'm getting this error:
DatabaseError at /polls/addcomment/
table polls_comment has no column named emailaddressRequest Method:
POST
Request URL: http://127.0.0.1:8000/polls/addcomment/
Django Version: 1.2.4
Exception Type: DatabaseError
Exception Value: table polls_comment has no column named emailaddress
Exception Location: C:\Python27\lib\site-packages\django\db\backends
\sqlite3\base.py in execute, line 200
Python Executable: C:\Python27\python.exe
Python Version: 2.7.1
Python Path: ['C:\\Users\\hversemann\\djangoprojects\\mysite', 'C:\
\Python\\Lib', 'C:\\Python\\Lib\\site-packages', 'C:\\Users\\hversemann
\\Desktop\\PythonSourceFiles', 'C:\\Users\\hversemann\\djangoprojects\
\mysite', 'C:\\WINDOWS\\system32\\python27.zip', 'C:\\Python27\\DLLs',
'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\
\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']
Server time: Mon, 14 Feb 2011 11:19:06 -0600
which is obviously wrong. So why does django not think I have that
field defined? Thanks in advance for the help.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.