Wednesday, January 26, 2011

Error when adding to many to Many table via Admin

Hi,

I am a newbie at Django, & have created my models as follows:

rom django.db import models
from django.contrib.auth.models import User

# Create your models here.

class Ingredient(models.Model):
#user=models.ForeignKey(User)
ingname = models.CharField(max_length=30)

def __unicode__(self):
return self.ingname

class Product(models.Model):
pname = models.CharField(max_length=70)
manuf = models.CharField (max_length=70)
ingredient = models.ManyToManyField(Ingredient)

def __unicode__(self):
return self.pname

class Meta:
ordering = ('pname',)

The Ingredients table works fine in admin; however, when I try to add
a new product, Django throws a fit. Below is the error I am getting:

DatabaseError at /admin/fs1/product/add/

no such table: fs1_product_ingredient

Request Method: POST
Request URL: http://localhost:8000/admin/fs1/product/add/
Django Version: 1.2.3
Exception Type: DatabaseError
Exception Value:

no such table: fs1_product_ingredient

Exception Location: /Library/Python/2.6/site-packages/django/db/
backends/sqlite3/base.py in execute, line 200
Python Executable: /usr/bin/python
Python Version: 2.6.1
Python Path: ['/Users/aa/Desktop/python/Django-1.2.3/django_fs', '/
System/Library/Frameworks/Python.framework/Versions/2.6/lib/
python26.zip', '/System/Library/Frameworks/Python.framework/Versions/
2.6/lib/python2.6', '/System/Library/Frameworks/Python.framework/
Versions/2.6/lib/python2.6/plat-darwin', '/System/Library/Frameworks/
Python.framework/Versions/2.6/lib/python2.6/plat-mac', '/System/
Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-
mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/
Versions/2.6/Extras/lib/python', '/System/Library/Frameworks/
Python.framework/Versions/2.6/lib/python2.6/lib-tk', '/System/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', '/
System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
lib-dynload', '/Library/Python/2.6/site-packages', '/System/Library/
Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC', '/
System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/
python/wx-2.8-mac-unicode']
Server time: Wed, 26 Jan 2011 15:31:02 -0600

Would appreciate your help on this. Thanks.
-ara

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment