Skip to content

Commit

Permalink
Merge branch 'master' into converters
Browse files Browse the repository at this point in the history
  • Loading branch information
K0Te committed Oct 10, 2018
2 parents 14dfd88 + e3c5f4c commit f4e26cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions django_object_manager/object_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ class ObjectManager:
def __init__(self):
"""Initialize object creator."""
self._instances = defaultdict(dict)
self._converters = copy(default_converters)
self._converters = {ForeignKey: self._create_foreing,
ManyToManyRel: self._create_m2m_rel,
ManyToManyField: self._create_m2m_field,
DateTimeField: self._parse_datetime,
OneToOneRel: self._make1to1}

@classmethod
def register(cls, model, data):
Expand Down Expand Up @@ -99,7 +103,6 @@ def _create_dependencies(self, model, params):
continue
for (converter_type, converter) in self._converters.items():
if isinstance(field, converter_type):
# TODO use namedtuple here ?
result = converter(self, field, params[field.name])
post_actions.extend(result.post_actions)
if not result.pass_field_value:
Expand Down

0 comments on commit f4e26cc

Please sign in to comment.