Ticket #15610: django_contenttypes.patch
File django_contenttypes.patch, 1015 bytes (added by , 14 years ago) |
---|
-
django/contrib/contenttypes/models.py
1 1 from django.db import models 2 2 from django.utils.translation import ugettext_lazy as _ 3 3 from django.utils.encoding import smart_unicode 4 from django.db import router, DEFAULT_DB_ALIAS 4 5 6 5 7 class ContentTypeManager(models.Manager): 6 8 7 9 # Cache to avoid re-looking up ContentType objects all over the place. … … 99 101 method. The ObjectNotExist exception, if thrown, will not be caught, 100 102 so code that calls this method should catch it. 101 103 """ 102 return self.model_class()._default_manager.using( self._state.db).get(**kwargs)104 return self.model_class()._default_manager.using(router.db_for_read(self.model_class()) or DEFAULT_DB_ALIAS).get(**kwargs) 103 105 104 106 def natural_key(self): 105 107 return (self.app_label, self.model)