>> I've been using 0.95 for a few months now, and the one thing that is really
>> annoying is using foreign keys in filter() and order_by() statements. Not
>> sure about a bug # (I will see if I can find one), but I always seem to end
>> up with errors about unknown table names, and end up having to do the
>> filtering or ordering in python rather than in the SQL. This is with MySQL
>> as the db, BTW, which I guess might make a difference.
> 
> Please do elaborate on this. AFAIK FKs in filter() work just fine, so
> if there's something broken we should know about it right away.

I'm not sure how Chris is filtering/ordering, but there are 
several ways of specifying fields, depending on the context.  In 
filtering, one needs to use the double-underscore scheme as in

        Foo.objects.filter(foreignfieldname__foreignfield = 42)

whereas in ordering, IIRC, you have to use periods instead:

        Entry.objects.order_by('-blogs_blog.name', 'headline')

Both work in Trunk, but their syntax is different enough that it 
can sting ya if you're not expecting it.  YMMV, but it works for 
everything I've thrown at it.

-tim



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