mirror of
https://github.com/django/django.git
synced 2025-10-29 08:36:09 +00:00
[1.6.x] Fixed #20292: Pass datetime objects (not formatted dates) as params to Oracle
This seems worthwhile in its own right, but also works around an Oracle
bug (in versions 10 -- 11.1) where the use of Unicode would reset the
date/time formats, causing ORA-01843 errors.
Thanks Trac users CarstenF for the report, jtiai for the initial patch,
and everyone who contributed to the discussion on the ticket.
Backport of 6983201 from master.
This commit is contained in:
@@ -20,7 +20,7 @@ from django.utils import unittest
|
||||
|
||||
from .models import (Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post,
|
||||
NullBooleanModel, BooleanModel, DataModel, Document, RenamedField,
|
||||
VerboseNameField, FksToBooleans)
|
||||
DateTimeModel, VerboseNameField, FksToBooleans)
|
||||
|
||||
|
||||
class BasicFieldTests(test.TestCase):
|
||||
@@ -154,6 +154,17 @@ class DateTimeFieldTests(unittest.TestCase):
|
||||
self.assertEqual(f.to_python('01:02:03.999999'),
|
||||
datetime.time(1, 2, 3, 999999))
|
||||
|
||||
def test_datetimes_save_completely(self):
|
||||
dat = datetime.date(2014, 3, 12)
|
||||
datetim = datetime.datetime(2014, 3, 12, 21, 22, 23, 240000)
|
||||
tim = datetime.time(21, 22, 23, 240000)
|
||||
DateTimeModel.objects.create(d=dat, dt=datetim, t=tim)
|
||||
obj = DateTimeModel.objects.first()
|
||||
self.assertTrue(obj)
|
||||
self.assertEqual(obj.d, dat)
|
||||
self.assertEqual(obj.dt, datetim)
|
||||
self.assertEqual(obj.t, tim)
|
||||
|
||||
class BooleanFieldTests(unittest.TestCase):
|
||||
def _test_get_db_prep_lookup(self, f):
|
||||
from django.db import connection
|
||||
|
||||
Reference in New Issue
Block a user