# Problem with looping through Users

**URL:** <https://forum.djangoproject.com/t/problem-with-looping-through-users/25570>\
**Category:** Using the ORM\
**Created:** [November 22, 2023, 10:17pm UTC](https://forum.djangoproject.com/t/problem-with-looping-through-users/25570 "2023-11-22T22:17:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 22, 2023, 11:23pm UTC](https://forum.djangoproject.com/t/problem-with-looping-through-users/25570/2 "2023-11-22T23:23:24Z")

</div>

> [@ejmmanning76](#):
>
> I am having a problem figuring out how to loop through the user so that I can figure there average.

You want your “base model” for your query to be on `User` then.

You can then annotate the scores for each user.

e.g.  
`user_list = User.objects.annotate(avg50=..., avg100=...)`

If you’re not familiar with annotations, start with the docs at [Aggregation | Django documentation | Django](https://docs.djangoproject.com/en/4.2/topics/db/aggregation/). Pay particular attention to the cheat sheet to see some examples, some of which are very close to what you’re looking to do.

---

_[View the full topic](https://forum.djangoproject.com/t/problem-with-looping-through-users/25570)._
