mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 06:57:16 +02:00
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()
|
||||
if not change:
|
||||
# adding a new object
|
||||
# no idea why this has to be called manually, __init__ does not seem to be called
|
||||
from evennia.utils.utils import class_from_module
|
||||
try:
|
||||
typeclass = class_from_module(obj.db_typeclass_path)
|
||||
except ImportError:
|
||||
typeclass = class_from_module("evennia.objects.objects.DefaultObject")
|
||||
obj.__class__ = typeclass
|
||||
# have to call init with typeclass passed to it
|
||||
obj.__init__(typeclass=obj.db_typeclass_path)
|
||||
obj.basetype_setup()
|
||||
obj.basetype_posthook_setup()
|
||||
obj.at_object_creation()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue