mirror of
https://github.com/carrotquest/django-clickhouse.git
synced 2024-11-15 05:46:41 +03:00
Fixed a bug in many_init
This commit is contained in:
parent
6db5f2b5bb
commit
42f823d3a5
|
@ -6,6 +6,7 @@ from collections import defaultdict
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from typing import List, Tuple, Iterable, Set, Any, Dict
|
from typing import List, Tuple, Iterable, Set, Any, Dict
|
||||||
|
|
||||||
|
import pytz
|
||||||
from django.db.models import Model as DjangoModel, QuerySet as DjangoQuerySet
|
from django.db.models import Model as DjangoModel, QuerySet as DjangoQuerySet
|
||||||
from infi.clickhouse_orm.database import Database
|
from infi.clickhouse_orm.database import Database
|
||||||
from infi.clickhouse_orm.engines import CollapsingMergeTree
|
from infi.clickhouse_orm.engines import CollapsingMergeTree
|
||||||
|
@ -81,6 +82,12 @@ class ClickHouseModel(with_metaclass(ClickHouseModelMeta, InfiModel)):
|
||||||
|
|
||||||
item = cls(__multi_init=True)
|
item = cls(__multi_init=True)
|
||||||
item.__dict__.update(cls._defaults)
|
item.__dict__.update(cls._defaults)
|
||||||
|
|
||||||
|
for name in kwargs:
|
||||||
|
field = cls._fields[name]
|
||||||
|
kwargs[name] = field.to_python(kwargs[name], pytz.utc)
|
||||||
|
field.validate(kwargs[name])
|
||||||
|
|
||||||
item.__dict__.update(kwargs)
|
item.__dict__.update(kwargs)
|
||||||
result.append(item)
|
result.append(item)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user