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 = ""
|
id1 = ""
|
||||||
id2 = ""
|
id2 = ""
|
||||||
print "cmd.obj:", cmd, cmd.obj
|
|
||||||
if (not (is_channel or is_exit) and
|
if (not (is_channel or is_exit) and
|
||||||
(hasattr(cmd, 'obj') and cmd.obj != caller) and
|
(hasattr(cmd, 'obj') and cmd.obj != caller) and
|
||||||
hasattr(cmd.obj, "key")):
|
hasattr(cmd.obj, "key")):
|
||||||
|
|
|
||||||
|
|
@ -197,23 +197,31 @@ class PlayerDBAdmin(BaseUserAdmin):
|
||||||
'description': "<i>These account details are shared by the admin "
|
'description': "<i>These account details are shared by the admin "
|
||||||
"system and the game.</i>"},),)
|
"system and the game.</i>"},),)
|
||||||
|
|
||||||
# TODO! Remove User reference!
|
def save_model(self, request, obj, form, change):
|
||||||
def save_formset(self, request, form, formset, change):
|
obj.save()
|
||||||
"""
|
|
||||||
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:
|
if not change:
|
||||||
# uname, passwd, email = str(request.POST.get(u"username")), \
|
#calling hooks for new player
|
||||||
# str(request.POST.get(u"password1")), \
|
ply = obj.typeclass
|
||||||
# str(request.POST.get(u"email"))
|
ply.basetype_setup()
|
||||||
typeclass = str(request.POST.get(
|
ply.at_player_creation()
|
||||||
u"playerdb_set-0-db_typeclass_path"))
|
|
||||||
create.create_player("", "", "",
|
## TODO! Remove User reference!
|
||||||
user=userobj,
|
#def save_formset(self, request, form, formset, change):
|
||||||
typeclass=typeclass,
|
# """
|
||||||
player_dbobj=userobj)
|
# 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)
|
admin.site.register(PlayerDB, PlayerDBAdmin)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue