Basically when a queryset like instance.annotate(totals=Count('item_description')[:3] like
PC 10
Mac 7
Mouse 5
Keyboard 4
I want to combine PC and Mac as say: Desktop so the results become
Desktop 17
Mac 7
Mouse 5
Keyboard 4
Scanner 3
Ant
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/ZuSxc3YXA3c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1J-NT2R5WxHeS6Qaw_ZjZCn6N4g%3DcP6Ta8gVE3MqsBP7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Thanks for the answer! Do you think it would be practical to let the orm generate the base query and then doing a replace on the column name? I was thinking of this approach as a custom manager method to return a raw result.
This would allow me the generate a case statement for the column and I could dynamically create it.
Ant
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/ZuSxc3YXA3c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1%2BFonHK4fuDUSaRbPd6%3DsWDVsisjYs%2BhUMZR7HhA60a2A%40mail.gmail.com.
Thanks for the answer! Do you think it would be practical to let the orm generate the base query and then doing a replace on the column name? I was thinking of this approach as a custom manager method to return a raw result.
This would allow me the generate a case statement for the column and I could dynamically create it.
Ant
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/ZuSxc3YXA3c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fb2374d5-c928-4322-a0f0-517c24586eb6%40googlegroups.com.