﻿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
9365	Permutated columns when using Paginator with ValuesQuerySet	micval@…	nobody	"I have this model:

{{{
#!python
class Document(models.Model):
    filename    = models.CharField(max_length=1000)
    filesize    = models.IntegerField()
    keywords    = models.CharField(max_length=1000)
    content     = models.TextField()
}}}

When selecting documents I don't want the content field to be selected (for performance issues), so I use values like this:

{{{
#!python
docs = Document.objects.values('id','filename','filesize','keywords')
}}}


But when feeding this list directly to Paginator, the columns get permutated, e.g.: `Paginator(docs,3,3,True).page(1).object_list` gives:

{{{
#!python
[{'keywords': 161, 'id': 1, 'filesize': u'sample file'}, 
{'keywords': 162, 'id': 2, 'filesize': u'another sample file'}, 
{'keywords': 163, 'id': 3, 'filesize': u'sample file'}]
}}}

If I ""evaluate"" docs first, the columns get their correct values:

{{{
#!python
[{'keywords': u'sample file', 'id': 1, 'filesize': 161}, 
{'keywords': u'another sample file', 'id': 2, 'filesize': 162}, 
{'keywords': u'sample file', 'id': 3, 'filesize': 163}]
}}}


I use `l = len(docs)` workaround in my views, which does the trick, but this behaviour puzzles me a little bit."	Bug	closed	Database layer (models, ORM)	1.0	Normal	worksforme	paginator valuesqueryset		Accepted	0	0	0	0	0	0
