From a33aa41fbf0f7b8e6d0806635cc21315b1fefc6e Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Sun, 29 Jan 2006 00:59:37 +0000 Subject: [PATCH] magic-removal: Fixed SingleRelatedObjectDescriptor for new manager syntax git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2153 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/fields/related.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index e49cef63ea..a2385f8393 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -87,7 +87,7 @@ class SingleRelatedObjectDescriptor(object): params = {'%s__%s__exact' % (self.field.rel.field_name, other_field.rel.field_name): val} else: params = {'%s__exact' % self.field.rel.field_name: val} - rel_obj = self.field.rel.to._default_manager.get_object(**params) + rel_obj = self.field.rel.to._default_manager.get(**params) setattr(instance, cache_name, rel_obj) return rel_obj @@ -108,6 +108,7 @@ class ManyRelatedObjectsDescriptor(object): # Dynamically create a class that subclasses the related # model's default manager. manager = types.ClassType('RelatedManager', (self.related.model._default_manager.__class__,), {})() + manager._use_cache = True # Set core_filters on the new manager to limit it to the # foreign-key relationship.