I'm getting a weird bug here and this is what I've deduced...

I've got a "Page" model and a "Content" model.  Content has a FK to 
Page.  I also have a "ContentType" model and Content has a FK to 
ContentType.  This is where I tell it if the content is text or other 
media content.

The problem comes when I use Content.objects to pull data...

This works:
  Content.objects.filter(page__number=11020)

But this doesn't:
  Content.objects.select_related().filter(page__number=11020)

When I view the SQL, the one with selected_related includes invalid 
tables in the SELECT clause, namely:

  '`page_contenttype6`.`id`',
  '`page_contenttype6`.`name`',

Even though it already has the real tables:

  '`page_contenttype`.`id`',
  '`page_contenttype`.`name`',

When I look in the django_content_type table, the row with id=6 is:
  |  6 | content type | contenttypes | contenttype |

This seems like too much of a coincidence.  The row for the 
"ContentType" content type is this:
  | 10 | content type | page         | contenttype |

How can I help further debug this?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to