summaryrefslogtreecommitdiff
path: root/django/db/models/fields
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/fields')
-rw-r--r--django/db/models/fields/related.py7
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]