From e214c036c8dfc13f028c07dba3afddbc7d2e93d0 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 22 Dec 2014 21:27:32 +0100 Subject: [PATCH] Resolved the setting of __dbclass__ which happened in the wrong order. --- src/typeclasses/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/typeclasses/models.py b/src/typeclasses/models.py index 5c46d055ff..21f298ddcf 100644 --- a/src/typeclasses/models.py +++ b/src/typeclasses/models.py @@ -1091,7 +1091,6 @@ class TypedObject(SharedMemoryModel): def __init__(self, *args, **kwargs): typeclass_path = kwargs.pop("typeclass", None) super(TypedObject, self).__init__(*args, **kwargs) - self.__dbclass__ = self._meta.proxy_for_model if typeclass_path: self.__class__ = self._import_class(typeclass_path) self.db_typclass_path = typeclass_path @@ -1099,6 +1098,8 @@ class TypedObject(SharedMemoryModel): self.__class__ = self._import_class(self.db_typeclass_path) else: self.db_typeclass_path = "%s.%s" % (self.__module__, self.__class__.__name__) + # important to put this at the end since _meta is based on the set __class__ + self.__dbclass__ = self._meta.proxy_for_model # initialize all handlers in a lazy fashion @lazy_property