Django QuerySet order <p>I am new to both django and python but I am beginning to get a grasp on things. I think.</p> <p>I have this problem and I can not seem to find an answer to it. (Though I assume it is really simple and the limiting factors are my google skills and lack of python/django knowledge)</p> <p>The scenario:</p> <p>a user can opt in to recieve temporary job openings at any number of stores he or she chooses.</p> <p>I would like to present a list of upcoming job openings (StoreEvents) sorted by the DateField only.</p> <pre><code>Example: Store A - 2009-04-20 Store B - 2009-04-22 Store A - 2009-04-23 </code></pre> <p>Atm I am stuck with presenting the data first sorted by store then by date since I am obviously accessing the StoreEvents through the Store model.</p> <pre><code>Example: Store A - 2009-04-20 Store A - 2009-04-23 Store B - 2009-04-22 </code></pre> <p>So my question is: Is it possible to create a QuerySet that looks like the first example and how do I do it?</p> <p>Examples of related models included:</p> <pre><code>class Store(models.Model): class StoreEvent(models.Model): info = models.TextField() date = models.DateField() store = models.ForeignKey(Store, related_name='events') class UserStore(models.Model): user = models.ForeignKey(User, related_name='stores') store = models.ForeignKey(Store, related_name='available_staff') </code></pre> <p>Edit:</p> <p>The following SQL does the trick but I still can't figure out how to do it in django:</p> <pre><code>SELECT * FROM store_storeevent WHERE store_id IN ( SELECT store_id FROM profile_userstore WHERE user_id =1 ) ORDER BY date </code></pre>