mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-25 10:13:45 +03:00
Accept datetime values for date fields (by Zloool)
This commit is contained in:
parent
cce85beeef
commit
9f2619a807
|
@ -79,6 +79,8 @@ class DateField(Field):
|
||||||
def to_python(self, value):
|
def to_python(self, value):
|
||||||
if isinstance(value, datetime.date):
|
if isinstance(value, datetime.date):
|
||||||
return value
|
return value
|
||||||
|
if isinstance(value, datetime.datetime):
|
||||||
|
return value.date()
|
||||||
if isinstance(value, int):
|
if isinstance(value, int):
|
||||||
return DateField.class_default + datetime.timedelta(days=value)
|
return DateField.class_default + datetime.timedelta(days=value)
|
||||||
if isinstance(value, string_types):
|
if isinstance(value, string_types):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user