#14754: TypeError: '[some aggregate function]' object does not support indexing ------------------------------------------+--------------------------------- Reporter: master | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: SVN Keywords: relabel_aliases, aggregate | Stage: Unreviewed Has_patch: 1 | ------------------------------------------+--------------------------------- Relabelling aliases on the query value, when this value is an Aggregate object, is expected.
A simplified example (don't look for a sense, it's just for the demo): {{{ from django.contrib.auth.models import User emails = User.objects.values('email').annotate( cnt=Count('id'), some_int=Count('username') ).filter(some_int=F('cnt')).values_list('email', flat=True) print User.objects.filter(email__in=emails).query }}} produces: {{{ File "D:\Python26\lib\site-packages\django- svn\django\db\models\sql\query.py", line 709, in change_aliases self.having.relabel_aliases(change_map) File "D:\Python26\lib\site-packages\django- svn\django\db\models\sql\where.py", line 251, in relabel_aliases child[3].relabel_aliases(change_map) File "D:\Python26\lib\site-packages\django- svn\django\db\models\sql\expressions.py", line 22, in relabel_aliases self.cols[node] = (change_map.get(col[0], col[0]), col[1]) TypeError: 'Count' object does not support indexing }}} A patch is provided, for django\db\models\sql\expressions.py -- Ticket URL: <http://code.djangoproject.com/ticket/14754> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.