mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 01:36:32 +01:00
Fixed a bug with creating Player from admin. It is hard to add permissions (these are Tags with a special subsetting). This makes the admin not very useful for creating players at the moment.
This commit is contained in:
parent
39def4efa9
commit
115587aa1b
2 changed files with 25 additions and 18 deletions
|
|
@ -262,7 +262,6 @@ def at_multimatch_cmd(caller, matches):
|
|||
|
||||
id1 = ""
|
||||
id2 = ""
|
||||
print "cmd.obj:", cmd, cmd.obj
|
||||
if (not (is_channel or is_exit) and
|
||||
(hasattr(cmd, 'obj') and cmd.obj != caller) and
|
||||
hasattr(cmd.obj, "key")):
|
||||
|
|
|
|||
|
|
@ -197,23 +197,31 @@ class PlayerDBAdmin(BaseUserAdmin):
|
|||
'description': "<i>These account details are shared by the admin "
|
||||
"system and the game.</i>"},),)
|
||||
|
||||
# TODO! Remove User reference!
|
||||
def save_formset(self, request, form, formset, change):
|
||||
"""
|
||||
Run all hooks on the player object
|
||||
"""
|
||||
super(PlayerDBAdmin, self).save_formset(request, form, formset, change)
|
||||
userobj = form.instance
|
||||
userobj.name = userobj.username
|
||||
def save_model(self, request, obj, form, change):
|
||||
obj.save()
|
||||
if not change:
|
||||
# uname, passwd, email = str(request.POST.get(u"username")), \
|
||||
# str(request.POST.get(u"password1")), \
|
||||
# str(request.POST.get(u"email"))
|
||||
typeclass = str(request.POST.get(
|
||||
u"playerdb_set-0-db_typeclass_path"))
|
||||
create.create_player("", "", "",
|
||||
user=userobj,
|
||||
typeclass=typeclass,
|
||||
player_dbobj=userobj)
|
||||
#calling hooks for new player
|
||||
ply = obj.typeclass
|
||||
ply.basetype_setup()
|
||||
ply.at_player_creation()
|
||||
|
||||
## TODO! Remove User reference!
|
||||
#def save_formset(self, request, form, formset, change):
|
||||
# """
|
||||
# Run all hooks on the player object
|
||||
# """
|
||||
# super(PlayerDBAdmin, self).save_formset(request, form, formset, change)
|
||||
# userobj = form.instance
|
||||
# userobj.name = userobj.username
|
||||
# if not change:
|
||||
# # uname, passwd, email = str(request.POST.get(u"username")), \
|
||||
# # str(request.POST.get(u"password1")), \
|
||||
# # str(request.POST.get(u"email"))
|
||||
# typeclass = str(request.POST.get(
|
||||
# u"playerdb_set-0-db_typeclass_path"))
|
||||
# create.create_player("", "", "",
|
||||
# user=userobj,
|
||||
# typeclass=typeclass,
|
||||
# player_dbobj=userobj)
|
||||
|
||||
admin.site.register(PlayerDB, PlayerDBAdmin)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue