Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Error when adding to many to Many table via Admin [RSS Feed]

#1 Jan. 26, 2011 22:00:01

a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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:
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+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 26, 2011 22:18:34

a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Error when adding to many to Many table via Admin


I fixed the problem; it appears I was using database settings for
Django 1.1; as soon as I included the full path for sqlite3, & added a
suffix of .db to my database name, all was well.

On Jan 26, 4:43 pm, ara <aaror...@gmail.com> wrote:
> 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:    
> 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+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Error when adding to many to Many table via Admin [RSS Feed]

Board footer

Moderator control

Enjoy the 12th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support