﻿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
16281	ContentType.get_object_for_this_type using wrong database for creating object	tfrydrychewicz@…	bcail	"There is a subtle error in [https://docs.djangoproject.com/en/1.3/ref/contrib/contenttypes/#django.contrib.contenttypes.models.ContentType.get_object_for_this_type ContentType.get_object_for_this_type] method.

{{{
def get_object_for_this_type(self, **kwargs):
    return self.model_class()._default_manager.using(self._state.db).get(**kwargs)
}}}

Database used to ''get'' ''model_class'' object is taken from self._state.db, which provides an error when ''contenttype'' model is hold in one database and model, of which object we're going to create, in another one.

Database should be provided using self.model_class().objects.db not self._state.db."	Bug	closed	contrib.contenttypes	dev	Normal	fixed	contenttype, object get_object_for_this_type, database, multiple	gklein@… bcail	Ready for checkin	1	0	0	0	0	0
