python sql query in django

Diez B. Roggisch deets at
Thu Feb 26 00:12:33 CET 2009

> I think Django is fabulous for the admin-interface, a simple text
> search and template inheritance.  I will use Django for all of those.
> What I'm not getting an answer to and cannot find an example of is a
> complex search, where I have to retrieve data from multiple tables,
> combine the data, remove the duplicates, etc between a web page and
> the database.  The code that started this thread is only a small piece
> of the complex data retrieval I need to do.  PHP is great for writing
> complex SQL queries right in the HTML template and I know exactly what
> it is doing.

First of all, mixing technologies without need is most of the times a 
bad idea - so if it is really the case that you can't solve all of your 
issues in django, you shouldn't use it at all, but solve them in PHP.

But to be honest - I doubt that django isn't capable of solving your 


for a introduction to the multitude of query-options. I doubt that your 
rather simple m:n-relationship is covered there.

I myself use SQLAlchemy, and that can for sure query and filter those 


More information about the Python-list mailing list