On Sun, 2006-07-16 at 09:33 +0000, [EMAIL PROTECTED] wrote:
> Hi.
> 
> Malcolm Tredinnick wrote:
> > I'll agree this one isn't too obvious (until you see the answer):
> >
> >         Blog.objects.filter(entries__isnull = False)
> >
> > will do what you want (have a look at the underlying SQL query is you
> > are interested in seeing that it really works as advertised).
> 
> I'm on the current trunk ( 0.95 (post-magic-removal) )
> 
> "entries__isnull=False" gives me:
> 
> psycopg.ProgrammingError: FEHLER:  Spalte
> m2m_models_blog__entries.entries existiert nicht
> 
> SELECT
> "models_blog"."id","models_blog"."title","models_blog"."description","models_blog"."region_id","models_blog"."regionname","models_blog"."date_submitted","models_blog"."author_id","models_blog"."visible"
> FROM "models_blog" LEFT OUTER JOIN "models_blog_entries" AS
> "m2m_models_blog__entries" ON "models_blog"."id" =
> "m2m_models_blog__entries"."blog_id" WHERE
> ("m2m_models_blog__entries"."entries" IS NOT NULL)
> 
> There's no "m2m...." stuff in the DB that I can find.

Well, first of all m2m_models_blog__entries is an alias (see the "FROM"
clause) for the models_blog_entries table. You should have a table in
your database that looks like models_blog_<something> which contains
three columns: an id, a blog_id and a submission_id (maybe not called
exactly that).

Is it possible that you renamed that attribute after running your
initial syncdb for these models? If not, can you post the names of the
tables for this application, please.

Unfortunately, the example I tested with before posting my reply used a
related model called Tag and an attribute called "tags", so the query
looks pretty believable on my end. However, I'm pretty sure we do name
the join table after the attribute.

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to