On Monday, September 9, 2013 12:13:09 AM UTC+3, Yegor Roganov wrote: > > I found out this is a so called "top n per group" problem and it's not > that easy to implement in django. Maybe someone could help me to find > another way (for example, alter the schema in some way)? >
This is something that would be nice to support with prefetch_related(). This is exactly the type of query where ORM abstraction would be very welcome. Writing this in SQL isn't easy, and the most efficient way to write the query varies a lot depending on the used database backend. Unfortunately I don't see other solutions than running multiple queries or using raw SQL. - Anssi -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.

