mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
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
This commit is contained in:
parent
943189a45d
commit
1ad6a8f5c1
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user