Quantcast
Channel: Django Aggregation of values queryset - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by dani herrera for Django Aggregation of values queryset

They are several approach, let's supose you want results in a dictionary, the easy way is:results = { 'internal': data.filter( value = 'internal' ).count(),'external': data.filter( value = 'external'...

View Article



Answer by catherine for Django Aggregation of values queryset

lists = ModelName.objects.values('type').annotate(count=Count('type'))In html: {% for list in lists %} {{list.type}} - {{list.count}}<br/> {% endfor %}Test: {{lists}} //don't use forloop yet....

View Article

Django Aggregation of values queryset

I have a ValuesQuerySet called data.I am trying to get a summary count of all the type for each objectdata.values('type') produces this output:[{'type': u'internal'}, {'type': u'internal'}, {'type':...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images