, but using our ORM (Django's), by itering over items, extracting max using the ORM, adding the value and comparing. I took a look at the ORM docs, and it wasn't feasible to build the equivalent SQL ...