diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-03-11 05:21:50 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-03-11 05:21:50 +0000 |
| commit | 619576002d538094dde7293d970bc4698ecdbef5 (patch) | |
| tree | 6f995d548b3bfc9eb921399ab4ee76958d612f0a /django/db/models/sql/query.py | |
| parent | 62bdb6eae8e62e7390f26daa261f75e5cca3b8e7 (diff) | |
queyrset-refactor: Added error reporting if somebody tries to order by a multi-valued field.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/query.py')
| -rw-r--r-- | django/db/models/sql/query.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index ef3f5220fb..7d24701438 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -509,8 +509,10 @@ class Query(object): pieces = name.split(LOOKUP_SEP) if not alias: alias = self.get_initial_alias() - field, target, opts, joins = self.setup_joins(pieces, opts, alias, - False) + result = self.setup_joins(pieces, opts, alias, False, False) + if isinstance(result, int): + raise FieldError("Cannot order by many-valued field: '%s'" % name) + field, target, opts, joins = result alias = joins[-1][-1] col = target.column |
