diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-09-01 21:04:01 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-09-01 21:04:01 +0000 |
| commit | d5cc16b47154e3788db5d38a39de70aef557eebb (patch) | |
| tree | 9d1e2f71f3971ed44c9a66b12fb47571522fb2a8 /django | |
| parent | b4d3f4e00420aee5167036d43752445b0959477d (diff) | |
Fixed #8076: fixed `get_(next/previous)_by_date` when used with subclasses. Thanks, bjornkri and jan_oberst.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8814 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/fields/related.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 4532385a4f..ef19477c30 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -142,7 +142,12 @@ class RelatedField(object): if hasattr(value, 'as_sql'): sql, params = value.as_sql() return QueryWrapper(('(%s)' % sql), params) - if lookup_type == 'exact': + + # FIXME: lt and gt are explicitally allowed to make + # get_(next/prev)_by_date work; other lookups are not allowed since that + # gets messy pretty quick. This is a good candidate for some refactoring + # in the future. + if lookup_type in ['exact', 'gt', 'lt']: return [pk_trace(value)] if lookup_type in ('range', 'in'): return [pk_trace(v) for v in value] |
