mirror of
https://github.com/django/django.git
synced 2025-09-24 19:23:03 +00:00
Fixed #12819. Fixed a bug with caching values of nullable 1to1 fields. Thanks, s.angel@twidi.com for the initial patch, and Alex Gaynor for the tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12543 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3f443363f9
commit
65b451ae3e
3 changed files with 19 additions and 2 deletions
|
@ -1203,7 +1203,7 @@ def get_cached_row(klass, row, index_start, max_depth=0, cur_depth=0,
|
|||
# If the base object exists, populate the
|
||||
# descriptor cache
|
||||
setattr(obj, f.get_cache_name(), rel_obj)
|
||||
if f.unique:
|
||||
if f.unique and rel_obj is not None:
|
||||
# If the field is unique, populate the
|
||||
# reverse descriptor cache on the related object
|
||||
setattr(rel_obj, f.related.get_cache_name(), obj)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue