Better solution - can call __init__ manually with typeclass as a kwarg, and this seems to resolve it
This commit is contained in:
parent
5e7211a053
commit
560def1f2b
1 changed files with 2 additions and 7 deletions
|
|
@ -147,13 +147,8 @@ class ObjectDBAdmin(admin.ModelAdmin):
|
||||||
obj.save()
|
obj.save()
|
||||||
if not change:
|
if not change:
|
||||||
# adding a new object
|
# adding a new object
|
||||||
# no idea why this has to be called manually, __init__ does not seem to be called
|
# have to call init with typeclass passed to it
|
||||||
from evennia.utils.utils import class_from_module
|
obj.__init__(typeclass=obj.db_typeclass_path)
|
||||||
try:
|
|
||||||
typeclass = class_from_module(obj.db_typeclass_path)
|
|
||||||
except ImportError:
|
|
||||||
typeclass = class_from_module("evennia.objects.objects.DefaultObject")
|
|
||||||
obj.__class__ = typeclass
|
|
||||||
obj.basetype_setup()
|
obj.basetype_setup()
|
||||||
obj.basetype_posthook_setup()
|
obj.basetype_posthook_setup()
|
||||||
obj.at_object_creation()
|
obj.at_object_creation()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue