﻿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
26801	Queryset gets corrupted when using nested Prefetch	Marcin	nobody	"When queryset objects contains nested Prefetch objects, after first evaluation it gets corrupted.

Im attaching simple example, to reproduce a bug you need to run these commands:

1. Install requirements file
2. python mange.py migrate
3. python manage runserver

Open your browser on:

http://127.0.0.1:8000/

And refresh '''twice'''. First time its gonna work, next time you should get an error:


{{{
AttributeError at /
Cannot find 'author' on UserProfile object, 'author__profile__university' is an invalid parameter to prefetch_related()
}}}


From my limited investigation it looks like after first evaluation prefetch_to parameter is prepended with previous prefetch_to param, which is in this case not correct.

Temporarly, its enough to create this object (queryset) again every time it gets used."	Bug	closed	Database layer (models, ORM)	1.8	Normal	duplicate	prefetch, queryset		Unreviewed	0	0	0	0	0	0
