mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Factored out a semi-complex if-test that was used in two places.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7782 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a8fa3fd81f
commit
5326cd293e
3 changed files with 22 additions and 6 deletions
|
@ -3,7 +3,7 @@ import warnings
|
|||
from django.conf import settings
|
||||
from django.db import connection, transaction, IntegrityError
|
||||
from django.db.models.fields import DateField, FieldDoesNotExist
|
||||
from django.db.models.query_utils import Q
|
||||
from django.db.models.query_utils import Q, select_related_descend
|
||||
from django.db.models import signals, sql
|
||||
from django.dispatch import dispatcher
|
||||
from django.utils.datastructures import SortedDict
|
||||
|
@ -761,8 +761,7 @@ def get_cached_row(klass, row, index_start, max_depth=0, cur_depth=0,
|
|||
index_end = index_start + len(klass._meta.fields)
|
||||
obj = klass(*row[index_start:index_end])
|
||||
for f in klass._meta.fields:
|
||||
if (not f.rel or (not restricted and f.null) or
|
||||
(restricted and f.name not in requested) or f.rel.parent_link):
|
||||
if not select_related_descend(f, restricted, requested):
|
||||
continue
|
||||
if restricted:
|
||||
next = requested[f.name]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue