On Sun, 2006-07-16 at 10:09 +0000, [EMAIL PROTECTED] wrote:
> Hi.
>
> I'm pretty sure I didn't rename anything after creating the DB.
>
> The error message I got was that the column
> "m2m_models_blog__entries.entries" doesn't exist. I get the same error
> when executing the SQL in psql directly.
>
> I hadn't seen that the m2m stuff was in the "AS" clause. OK, so
> m2m_models_blog__entries is an alias for models_blog_entries -- I
> *have* this table, but it has no column "entries".
OK, that's just weird. In my case, the SQL is being correctly converted
to match the "tag_id" column (the equivalent of your "submission_id").
Not sure what's going on there right at the moment.
[...]
> If I do this:
>
> Blog.objects.filter(entries__blog__id__isnull = False)
>
> I get a list of Blogs which have entries, however I have duplicates in
> the list, one for each Submission which is in a M2M relationship (i.e.
> each Blog is shown n times if it has n entries).
That should be fixed by using the distinct() method as well:
Blog.objects.filter(entries__blog__id__isnull =
False).distinct()
I hadn't noticed the non-distinct results in my case either, but it
makes sense now that you mention it.
Sorry, I'm not sure why you are seeing the bad SQL being generated; but
at least you have a not-too-painful workaround that gives the same
results. There's a bug in there somewhere. Maybe file a ticket and
somebody will look at it when we have time.
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 [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-users
-~----------~----~----~----~------~----~------~--~---