Fixes by tsionyx

This commit is contained in:
Itai Shirav 2016-09-29 11:24:22 +03:00
parent 685e3dffe9
commit b2cf8f4245
2 changed files with 4 additions and 2 deletions

View File

@ -228,8 +228,8 @@ You can create array fields containing any data type, for example::
class SensorData(models.Model):
date = fields.DateField()
temperatures = fields.ArrayField(fields.Float32Field)
humidity_levels = fields.ArrayField(fields.UInt8Field)
temperatures = fields.ArrayField(fields.Float32Field())
humidity_levels = fields.ArrayField(fields.UInt8Field())
engine = engines.MergeTree('date', ('date',))

View File

@ -107,6 +107,8 @@ class DateTimeField(Field):
if isinstance(value, int):
return datetime.datetime.fromtimestamp(value, pytz.utc)
if isinstance(value, string_types):
if value == '0000-00-00 00:00:00':
return self.class_default
return datetime.datetime.strptime(value, '%Y-%m-%d %H:%M:%S')
raise ValueError('Invalid value for %s - %r' % (self.__class__.__name__, value))