id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 7323,QuerySetPaginator on a QuerySet with values() throws an AssertionError on multiple columns,farhan@…,nobody,"I have a simple QuerySetPaginator where I am using a QuerySet with values() as the source. This used to work before queryset-refactor branch was merged, but now has stopped working. {{{ In [1]: from thebitguru.nodes.models import * In [2]: from django.core.paginator import QuerySetPaginator In [3]: queryset = ContentNode.objects.values(""id"",""title"") In [4]: paginator = QuerySetPaginator(queryset, 10) In [5]: page = paginator.page(1) --------------------------------------------------------------------------- AssertionError Traceback (most recent call last) /storage/important/Development/django/thebitguru/ in () /storage/important/Development/django/packages/django_temp_trunk/django/core/paginator.py in page(self, number) 27 def page(self, number): 28 ""Returns a Page object for the given 1-based page number."" ---> 29 number = self.validate_number(number) 30 bottom = (number - 1) * self.per_page 31 top = bottom + self.per_page /storage/important/Development/django/packages/django_temp_trunk/django/core/paginator.py in validate_number(self, number) 18 if number < 1: 19 raise InvalidPage('That page number is less than 1') ---> 20 if number > self.num_pages: 21 if number == 1 and self.allow_empty_first_page: 22 pass /storage/important/Development/django/packages/django_temp_trunk/django/core/paginator.py in _get_num_pages(self) 44 ""Returns the total number of pages."" 45 if self._num_pages is None: ---> 46 hits = self.count - 1 - self.orphans 47 if hits < 1: 48 hits = 0 /storage/important/Development/django/packages/django_temp_trunk/django/core/paginator.py in _get_count(self) 68 def _get_count(self): 69 if self._count is None: ---> 70 self._count = self.object_list.count() 71 return self._count 72 count = property(_get_count) /storage/important/Development/django/packages/django_temp_trunk/django/db/models/query.py in count(self) 182 return len(self._result_cache) 183 --> 184 return self.query.get_count() 185 186 def get(self, *args, **kwargs): /storage/important/Development/django/packages/django_temp_trunk/django/db/models/sql/query.py in get_count(self) 220 obj.select = [] 221 obj.extra_select = {} --> 222 obj.add_count_column() 223 data = obj.execute_sql(SINGLE) 224 if not data: /storage/important/Development/django/packages/django_temp_trunk/django/db/models/sql/query.py in add_count_column(self) 1343 else: 1344 assert len(self.select) == 1, \ -> 1345 ""Cannot add count col with multiple cols in 'select': %r"" % self.select 1346 select = Count(self.select[0]) 1347 else: AssertionError: Cannot add count col with multiple cols in 'select': [('nodes_contentnode', 'id'), ('nodes_contentnode', 'title')] }}} I found a similar report at: http://groups.google.com.au/group/django-users/browse_thread/thread/b39cd188847c4f94",,closed,Core (Other),dev,,fixed,qsrf-cleanup,farhan@…,Unreviewed,0,0,0,0,0,0