Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed custom_lookups tests for Oracle

Refs #21821
  • Loading branch information...
commit 980eda01909c9fd5c5e16f276ca663e71371a0a2 1 parent 1c360db
@akaariai akaariai authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 tests/custom_lookups/tests.py
View
12 tests/custom_lookups/tests.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from datetime import date
import unittest
@@ -16,6 +18,12 @@ def as_sql(self, qn, connection):
params.extend(rhs_params)
return '%s %%%% 3 = %s' % (lhs, rhs), params
+ def as_oracle(self, qn, connection):
+ lhs, params = self.process_lhs(qn, connection)
+ rhs, rhs_params = self.process_rhs(qn, connection)
+ params.extend(rhs_params)
+ return 'mod(%s, 3) = %s' % (lhs, rhs), params
+
class Div3Transform(models.Transform):
lookup_name = 'div3'
@@ -24,6 +32,10 @@ def as_sql(self, qn, connection):
lhs, lhs_params = qn.compile(self.lhs)
return '%s %%%% 3' % (lhs,), lhs_params
+ def as_oracle(self, qn, connection):
+ lhs, lhs_params = qn.compile(self.lhs)
+ return 'mod(%s, 3)' % lhs, lhs_params
+
class YearTransform(models.Transform):
lookup_name = 'year'
Please sign in to comment.
Something went wrong with that request. Please try again.