Django GROUP BY field value

Viewed 24615

Surprising that I could not find a way to make a group by query.

I have a query set qs and I am trying to group by some_prop.val, considering qs is excluding entries where some_prop is None.

Let's say the values are [1, 2, 3], then I would be after a result like this:

{1: entries1, 2: entries2, 3: entries3}

Does the Django ORM provide any feature to group results like this?

1 Answers
Related