You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I looked into this a bit. There are a few things Django doesn't let you do with a union queryset, as you note above, you can't call distinct() on it. You also can't call annotate(), which means the core of how the pivot function works would have to be re-written and I'm not sure it's even possible (depending on what kind of aggregate you want to do) to do that through the ORM.
Hi there,
I'm trying to get some dashboarded datas on some models, and even between models.
issue description :
When I union 2 queryset of models objects, and then try to pivot with pivot_table, I've got the issue :
django.db.utils.NotSupportedError: Calling QuerySet.distinct() after union() is not supported.
Step to reproduce :
a=models.MYModel.objects.filter(pk=1)
b=models.MYModel.objects.filter(pk=2)
c=a.union(b)
pivot_table = pivot(c, 'field1', 'field2', 'field3')
=> raise the error above
is there anything I missed ?
infos :
django v4.1.2
python v3.9.2
django-pivot v1.9.0
The text was updated successfully, but these errors were encountered: