Hi René,
On Tue, 21 Jul 2020 18:46:12 +0200
René Fleschenberg <
re...@fleschenberg.net> wrote:
>
https://github.com/kako-nawao/django-group-by
>
It doesn't actually aggregate, so the name "group-by" seems
unwarranted. What it does, as the README explains, is replace "values"
by something which does two things:
- Sets the seclected fields as attributes on the object returned,
rather than as dict values
- Where the selected field is a FK, follows the relationship to get the
object
> Is there a deeper reason why this functionality is not available in
> Django core?
If I'm not mistaken, only() provides this functionality, with the
difference that if you then try to access an unselected attribute on the
object, with only() it is fetched, while with this "group_by()" you get
an AttributeError.
(django-group-by has other limitations -- e.g. it is designed to
handle "rel__field" but not "rel1__rel2__field")
Did I miss anything important?