From 7355fa6b728357a3e7257fbe1175d68a0d7e2ec1 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 23 Feb 2008 01:34:49 +0000 Subject: queryset-refactor: Implemented slicing to end of querysets. Refs #2150, #5012. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7147 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/sql/query.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'django/db/models/sql/query.py') diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 20dcb4b71d..f251730c48 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -262,11 +262,15 @@ class Query(object): if ordering: result.append('ORDER BY %s' % ', '.join(ordering)) + # FIXME: Pull this out to make life easier for Oracle et al. if with_limits: if self.high_mark: result.append('LIMIT %d' % (self.high_mark - self.low_mark)) if self.low_mark: - assert self.high_mark, "'offset' is not allowed without 'limit'" + if not self.high_mark: + val = self.connection.ops.no_limit_value() + if val: + result.append('LIMIT %d' % val) result.append('OFFSET %d' % self.low_mark) params.extend(self.extra_params) -- cgit v1.3