diff -r e821a1ae9773 -r 75f8f05f9a60 web/hdalab/views/ajax.py --- a/web/hdalab/views/ajax.py Fri Mar 02 10:48:26 2012 +0100 +++ b/web/hdalab/views/ajax.py Fri Mar 02 23:25:56 2012 +0100 @@ -170,7 +170,15 @@ else: contenus = contenus.values() - tagqs = tagqs.annotate(nb=Count('datasheet')).order_by('-nb')[:tag_count] + #tagqs = tagqs.annotate(nb=Count('datasheet')).order_by('-nb')[:tag_count] + tagqs = tagqs.annotate(nb=Count('datasheet')).order_by('-nb').only('id','label')[:tag_count] + # hack to add only necessary fileds in the group by + # contournement bug https://code.djangoproject.com/ticket/17144 + tagqs.query.clear_select_fields() + tagqs.query.add_fields(['id','label'], False) + tagqs.query.set_group_by() + + #hack : django bug tags = [{'id': tag.id, 'label': tag.label, 'score': tag.nb} for tag in tagqs]