Alex Gaynor 11/24/2008

A timeline view in Django

Read Original

This technical article addresses a common Django challenge: creating a timeline view that displays objects from multiple models ordered by a common key (like a date). It critiques inefficient methods (like generic relations) that cause O(N) queries and presents a solution that performs O(k) queries by fetching sorted querysets for each model and then merging them in Python. The post includes example code for a merge function to combine the querysets efficiently, prioritizing database scalability.

A timeline view in Django

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week