summaryrefslogtreecommitdiff
path: root/django/db/models/base.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-04 03:21:31 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-04 03:21:31 +0000
commitdded5f52cc1dbe0e58b64a3217e12e72da7bed23 (patch)
tree1c3cc230ff7713ab4bbd7d9da39aaa620e0302c1 /django/db/models/base.py
parent19d14509299c641ee44ab0755a6e0f3026e48341 (diff)
Fixed #10695 -- Fixed implementation of deferred attribute retrieval.
The original implementation had a few silly bugs in it that meant that data was not being used only on the instance of the class that it was appropriate for (one of the traps when using class-level things). No more! Thanks to Justin Bronn and Alex Gaynor for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10382 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/base.py')
-rw-r--r--django/db/models/base.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 01e2ca7011..05cd0d9ea1 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -362,9 +362,8 @@ class Model(object):
# DeferredAttribute classes, so we only need to do this
# once.
obj = self.__class__.__dict__[field.attname]
- pk_val = obj.pk_value
model = obj.model_ref()
- return (model_unpickle, (model, pk_val, defers), data)
+ return (model_unpickle, (model, defers), data)
def _get_pk_val(self, meta=None):
if not meta:
@@ -635,12 +634,12 @@ def get_absolute_url(opts, func, self, *args, **kwargs):
class Empty(object):
pass
-def model_unpickle(model, pk_val, attrs):
+def model_unpickle(model, attrs):
"""
Used to unpickle Model subclasses with deferred fields.
"""
from django.db.models.query_utils import deferred_class_factory
- cls = deferred_class_factory(model, pk_val, attrs)
+ cls = deferred_class_factory(model, attrs)
return cls.__new__(cls)
model_unpickle.__safe_for_unpickle__ = True