On Mon, 2008-11-03 at 03:02 -0800, Dima Dogadaylo wrote:
> Before merging of queryset-refactor it was possible to join any table
> with any ON clause to any queryset with help of Q.as_sql. 

It was "possible" for small values of possible that meant "extremely
fragile and didn't work in a large number of cases". That's why more
sophisticated support was needed for custom Q-like objects.

> For example,
> please see this one:
> http://www.djangosnippets.org/snippets/257/
> 
> Since Django 1.0 ORM looks like more complicated, Q.as_sql is
> disappeared (but still mentioned in docs (http://
> docs.djangoproject.com/en/dev/ref/models/fields/).

I don't see where you're seeing this reference still. A search on that
page doesn't turn up the sequence "as_sql" at all.

>  As I see from code
> Q.as_sql was replaced with Q.add_to_query(self, query, used_aliases)
> but from current code it looks like new implementation does not allow
> to use ON clause with more than 1 statements, for example:

The new code allows you to make any changes you like to the query, so
it's fully general. That is why the Query class is passed in. You write
an object that has an add_to_query() method and then you can do whatever
you like. Mostly this will involve calling query.join() and/or
query.add_filter(). Have a look at the docstring for join() in
particular to see how to promote a join to LEFT OUTER.

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