﻿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:[[BR]]
[[BR]]


class Document(models.Model):[[BR]]

    filename    = models.CharField(max_length=1000)[[BR]]

    filesize    = models.IntegerField()[[BR]]

    keywords    = models.CharField(max_length=1000)[[BR]]

    content     = models.TextField()[[BR]]


When selecting documents I don't want the content field to be selected (for performance issues), so I use values like this:[[BR]]
[[BR]]


docs = Document.objects.values('id','filename','filesize','keywords')[[BR]]
[[BR]]


But when feeding this list directly to Paginator, the columns get permutated, e.g.:[[BR]]
[[BR]]


Paginator(docs,3,3,True).page(1).object_list gives:[[BR]]

[{'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'}][[BR]]
[[BR]]


If I ""evaluate"" docs first, the columns get their correct values:[[BR]]

[{'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}][[BR]]
[[BR]]


I use ""l = len(docs)"" workaround in my views, which does the trick, but this behaviour puzzles me a little bit."		new	Database layer (models, ORM)	1.0			paginator valuesqueryset		Unreviewed	0	0	0	0		0
