1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

boulder-oracle-sprint: Fixed #3748.

git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@5020 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Boulder Sprinters 2007-04-17 16:56:13 +00:00
parent ab622a35bd
commit 1d90cbd758

View File

@ -580,13 +580,8 @@ class DateTimeField(DateField):
def flatten_data(self,follow, obj = None):
val = self._get_val_from_obj(obj)
date_field, time_field = self.get_manipulator_field_names('')
# cx_Oracle does not support strftime
if settings.DATABASE_ENGINE == 'oracle':
return {date_field: (val is not None or ''),
time_field: (val is not None or '')}
else:
return {date_field: (val is not None and val.strftime("%Y-%m-%d") or ''),
time_field: (val is not None and val.strftime("%H:%M:%S") or '')}
return {date_field: (val is not None and val.strftime("%Y-%m-%d") or ''),
time_field: (val is not None and val.strftime("%H:%M:%S") or '')}
def formfield(self, **kwargs):
defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text}