2007-04-25 19:39:15 +00:00
|
|
|
from django.contrib.auth.models import User, Group
|
2008-12-15 04:35:00 +00:00
|
|
|
from src.objects.models import Object
|
|
|
|
|
from src.config.models import ConfigValue
|
2007-04-25 19:39:15 +00:00
|
|
|
|
|
|
|
|
def handle_setup():
|
2008-06-13 19:52:29 +00:00
|
|
|
# Set the initial user's username on the #1 object.
|
|
|
|
|
god_user = User.objects.filter(id=1)[0]
|
|
|
|
|
god_user_obj = Object.objects.filter(id=1)[0]
|
|
|
|
|
god_user_obj.set_name(god_user.username)
|
2007-04-25 19:39:15 +00:00
|
|
|
|
2008-06-13 19:52:29 +00:00
|
|
|
groups = ("Immortals", "Wizards", "Builders", "Player Helpers")
|
|
|
|
|
for group in groups:
|
|
|
|
|
newgroup = Group()
|
|
|
|
|
newgroup.name = group
|
|
|
|
|
newgroup.save()
|
2007-04-25 19:39:15 +00:00
|
|
|
|
2008-06-13 19:52:29 +00:00
|
|
|
# We don't want to do initial setup tasks every startup, only the first.
|
2008-06-15 17:21:02 +00:00
|
|
|
ConfigValue.objects.set_configvalue('game_firstrun', '0')
|