OK I'm using django 0.95, python 2.4.4 and MySql 5.0.20a-nt on Win
2000. I have the following model code:
from django.db import models
class Purchaser(models.Model):
name = models.CharField(maxlength=200)
memberid = models.IntegerField()
email = models.CharField(maxlength=200)
def __str__(self):
return self.name
class Card(models.Model):
purchaser = models.ForeignKey(Purchaser)
amount = models.FloatField(decimal_places=2, max_digits=4)
date = models.DateTimeField()
expiration = models.DateTimeField()
currentAmount = models.FloatField(decimal_places=2, max_digits=4)
def __str__(self):
return str(self.id) + " [" + str(self.purchaser) + "] " +
str(self.amount) + " (" + str(self.currentAmount) + ")"
I run the following code (I previously created a Purchaser):
>>> from foo.giftcards.models import Purchaser, Card
>>> p = Purchaser.objects.all()[0]
>>> c = Card(purchaser=p, amount=50, date=datetime.now(),
>>> expiration=datetime.now(), currentAmount=50)
>>> c.save()
Traceback (most recent call last):
File "<console>", line 1, in ?
File
"C:\Python24\lib\site-packages\django-0.95-py2.4.egg\django\db\mode
e.py", line 203, in save
','.join(placeholders)), db_values)
File
"C:\Python24\lib\site-packages\django-0.95-py2.4.egg\django\db\back
til.py", line 12, in execute
return self.cursor.execute(sql, params)
File
"C:\Python24\lib\site-packages\django-0.95-py2.4.egg\django\db\back
ysql\base.py", line 35, in execute
return self.cursor.execute(sql, params)
File "C:\Python24\lib\site-packages\MySQLdb\cursors.py", line 163, in
ex
self.errorhandler(self, exc, value)
File "C:\Python24\lib\site-packages\MySQLdb\connections.py", line 35,
in
lterrorhandler
raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'purchaser_id' in 'field
list'")
I can go look at the schema for this app, and the card table does
indeed have a purchaser_id column of the appropriate type, so I'm not
sure what the deal is. I've tried multiple manage.py syncdb commands
and nothing happens. As a total django n00b, I'm sure I'm doing
something stupid, but I can't see it. Any suggestions?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---