It's a built in query. In the admin, I added an AuthorCategory, which worked fine. Then I added a BookCategory and set the AuthorCategory as a parent, and got the error. Here is the query that is generated:
SELECT product_category.id, product_category.site_id, product_category.name, product_category.slug, product_category.parent_id, product_category.meta, product_category.description, product_category.ordering, custom_satchmo_bookcategory.category_ptr_id, custom_satchmo_bookcategory.parent_id FROM custom_satchmo_bookcategory INNER JOIN product_category ON (custom_satchmo_bookcategory.category_ptr_id = product_category.id) INNER JOIN django_site ON (product_category.site_id = django_site.id) INNER JOIN product_category T5 ON (custom_satchmo_authorcategory.category_ptr_id = T5.id) WHERE product_category.slug = ? ORDER BY django_site.domain ASC, custom_satchmo_bookcategory.parent_id ASC, product_category.ordering ASC, product_category.name ASC The problem is custom_satchmo_authorcategory.category_ptr_id. That column exists, but you'll notice that table custom_satchmo_authorcategory is not included in the FROM anywhere. On Mar 23, 12:45 pm, Bob Waycott <[email protected]> wrote: > Nothing looks seriously amiss with the model code at first glance. Care to > share the query you are issuing that fails? > Thanks, > > Bob > > On Mon, Mar 23, 2009 at 12:30 PM, Jon <[email protected]> wrote: > > > This is the models.py for the relevant classes. > > > from django.db import models > > from django.contrib.auth.models import User > > from satchmo.product.models import Category > > from django.utils.translation import ugettext_lazy as _ > > import config > > > class AuthorCategory(Category): > > author = models.OneToOneField(User) > > def _get_subtype(self): > > return 'AuthorCategory' > > > class Admin: > > pass > > > class Meta: > > verbose_name = _('Author Category') > > verbose_name_plural = _('Author Categories') > > > class BookCategory(Category): > > parent = models.ForeignKey('AuthorCategory') > > def _get_subtype(self): > > return 'BookCategory' > > > class Admin: > > pass > > > class Meta: > > verbose_name = _('Book Category') > > verbose_name_plural = _('Book Categories') --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo 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/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---
