﻿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
34819	GenericForeignKey.get_prefetch_queryset()	Richard Laager	Clifford Gama	"`get_prefetch_queryset()` returns two functions. The caller calls them `rel_obj_attr` and `instance_attr`.  They return a tuple of `(pk, cls)`. They need to match so that objects can be pulled from the cache.  In `GenericForeignKey.get_prefetch_query()`, there is a bug where `gfk_key()` (the `rel_obj_attr`) returns a `get_prep_value()`d value but the `instance_attr` lambda returns `obj.pk`.

Accordingly, for objects where the prepped value and the Python representation are not the same (e.g. the database uses a string and the Python representation is an object instance), these will not match. This makes things like `Model.objects.prefetch_related('content_object').get(id=123)` clear (set to `None`) the `content_object`.

The fix is to call `get_prep_value()` in the `instance_attr` code path."	Bug	closed	contrib.contenttypes	3.2	Normal	fixed			Ready for checkin	1	0	0	0	0	0
