mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
parent
1c360dbbf5
commit
980eda0190
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@ -16,6 +18,12 @@ class Div3Lookup(models.Lookup):
|
|||||||
params.extend(rhs_params)
|
params.extend(rhs_params)
|
||||||
return '%s %%%% 3 = %s' % (lhs, 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):
|
class Div3Transform(models.Transform):
|
||||||
lookup_name = 'div3'
|
lookup_name = 'div3'
|
||||||
@ -24,6 +32,10 @@ class Div3Transform(models.Transform):
|
|||||||
lhs, lhs_params = qn.compile(self.lhs)
|
lhs, lhs_params = qn.compile(self.lhs)
|
||||||
return '%s %%%% 3' % (lhs,), lhs_params
|
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):
|
class YearTransform(models.Transform):
|
||||||
lookup_name = 'year'
|
lookup_name = 'year'
|
||||||
|
Loading…
Reference in New Issue
Block a user