On Wed, 2007-05-16 at 20:53 -0500, Ben Jones wrote:
> Thanks for the help, Russ.
> 
> 
> > > For test data, I have entered 3 categories and 3 pieces of content
> > > (one in each of the 3 categories).
> >
> > You have 3 categories and 3 content objects, but what is in the m2m
> > table between them? What is the matrix of category/content
> > relationships?
> 
> It's the content_categories relationship table the Django so kindly
> creates for me.

Russell was asking what is in the table and how do the table entries map
to the models on either end (i.e. just knowing the id values in the
intermediate table doesn't tell us anything much).

> > > In my understanding of the docs, I expected to be able to use the line
> > > of code below to retrieve all pieces of content in the category with a
> > > slug of 'list-1'. However, that appears to not be the case, as every
> > > record from Content is returned.
> > >
> > > >>> Content.objects.filter(categories__slug__exact = 'list-1')
> > > [<Content: Piece 1>, <Content: Piece 2>, <Content: Da 3rd>]
> >
> > The syntax appears right for the problem you are describing;
> 
> . . . and strangely enough it seems to work just fine in MySQL.
> However, in sqlite I get the results previously described -- even
> after resetting the database and re-adding the records and verifying
> the expected result on the command line (1 record each in the
> relationship table)
> 
> Very odd. Or maybe not so odd to somebody that's more familiar with
> sqlite than I am. This is actually the first time I've ever used it
> for anything.

Might be worthwhile having a look at the SQL Django is generating. From
the shell prompt import db.connection and have a look at
db.connection.queries after running the query.

I wouldn't be too surprised to discover this is a bug caused by using a
left outer join here, in which case it's already in the pipeline to be
fixed (there are a couple of cases where that's happening). However, it
would be good to confirm that.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to