From 1ad6a8f5c1509d20fcebcb45f40410c23baae493 Mon Sep 17 00:00:00 2001 From: Boulder Sprinters Date: Thu, 19 Apr 2007 21:03:56 +0000 Subject: [PATCH] boulder-oracle-sprint: Removed Oracle-specific code from DateField.get_db_prep_save and DateTimeField.get_db_prep_save. Casting to a datetime object is no longer necessary here, because the cursor wrapper automatically sets ansi date and timestamp formats. git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@5035 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/fields/__init__.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index bf3f535a84..ff85ca6c5b 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -495,11 +495,7 @@ class DateField(Field): def get_db_prep_save(self, value): # Casts dates into string format for entry into database. - if settings.DATABASE_ENGINE == 'oracle': - # cx_Oracle needs a conversion to datetime.datetime instead. - if isinstance(value, datetime.date): - value = datetime.datetime.combine(value, datetime.time()) - elif value is not None: + if value is not None: value = value.strftime('%Y-%m-%d') return Field.get_db_prep_save(self, value) @@ -541,9 +537,6 @@ class DateTimeField(DateField): # neither database supports microseconds. if settings.DATABASE_ENGINE in ('mysql', 'oracle') and hasattr(value, 'microsecond'): value = value.replace(microsecond=0) - # cx_Oracle wants the raw datetime instead of a string. - if settings.DATABASE_ENGINE != 'oracle': - value = str(value) return Field.get_db_prep_save(self, value) def get_db_prep_lookup(self, lookup_type, value):