diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-03-22 01:45:22 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-03-22 01:45:22 +0000 |
| commit | 5ac154e06568b9815e85b32f144ab4ee10190a61 (patch) | |
| tree | f95391869bfad2011b0a7cb17089b33005c5733d /django/db/models/base.py | |
| parent | 10923b42b33dc6b756d06b235c135bc40a35435a (diff) | |
Fixed deferred loading of fields with default values.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/base.py')
| -rw-r--r-- | django/db/models/base.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py index 013dc96e92..01e2ca7011 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -272,14 +272,14 @@ class Model(object): for field in fields_iter: is_related_object = False + # This slightly odd construct is so that we can access any + # data-descriptor object (DeferredAttribute) without triggering its + # __get__ method. + if (field.attname not in kwargs and + isinstance(self.__class__.__dict__.get(field.attname), DeferredAttribute)): + # This field will be populated on request. + continue if kwargs: - # This slightly odd construct is so that we can access any - # data-descriptor object (DeferredAttribute) without triggering - # its __get__ method. - if (field.attname not in kwargs and - isinstance(self.__class__.__dict__.get(field.attname), DeferredAttribute)): - # This field will be populated on request. - continue if isinstance(field.rel, ManyToOneRel): try: # Assume object instance was passed in. |
