Re: annotation and grouping

2009-05-04 Thread omat * gezgin.com
Thanks for the detailed reply Russ. I added a boolean field to the model to specify the most current entry for the user, updated with save(), thus letting me to fetch records of the most current entries with a simple query. I think de-normalization and avoiding expensive complex aggregate querie

Re: annotation and grouping

2009-04-29 Thread Russell Keith-Magee
On Wed, Apr 29, 2009 at 4:08 PM, omat wrote: > > Hi all, > > I would like to fetch the latest entries for each user from a model > like: > > class Entry(models.Model): >    user = models.ForeignKey(User) >    entry = models.TextField() >    date = models.DateTimeField(auto_now_add=True) > > Is it

annotation and grouping

2009-04-29 Thread omat
Hi all, I would like to fetch the latest entries for each user from a model like: class Entry(models.Model): user = models.ForeignKey(User) entry = models.TextField() date = models.DateTimeField(auto_now_add=True) Is it possible with the current API with a single query? I.e., would