diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-06-29 09:40:17 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-06-29 09:40:17 +0000 |
| commit | 5326cd293ef39408c325d592afdb87cb432007bd (patch) | |
| tree | 4b0ee96fa9bd6d20b3b1d23cd853b9281d2255fe /django/db/models/sql | |
| parent | a8fa3fd81fee316144986328f3df1e811015f1d9 (diff) | |
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
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index b30133c0e5..ac8222b7b0 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -15,9 +15,10 @@ from django.utils.datastructures import SortedDict from django.dispatch import dispatcher from django.db import connection from django.db.models import signals +from django.db.models.fields import FieldDoesNotExist +from django.db.models.query_utils import select_related_descend from django.db.models.sql.where import WhereNode, EverythingNode, AND, OR from django.db.models.sql.datastructures import Count -from django.db.models.fields import FieldDoesNotExist from django.core.exceptions import FieldError from datastructures import EmptyResultSet, Empty, MultiJoin from constants import * @@ -915,8 +916,7 @@ class Query(object): restricted = False for f, model in opts.get_fields_with_model(): - if (not f.rel or (restricted and f.name not in requested) or - (not restricted and f.null) or f.rel.parent_link): + if not select_related_descend(f, restricted, requested): continue dupe_set = orig_dupe_set.copy() used = orig_used.copy() |
