Commits

Anonymous committed 59f0b82

Extended the setup 1st user to create few more entities

  • Participants
  • Parent commits aed3524

Comments (0)

Files changed (1)

 from django.http import HttpResponse
 from django.utils import simplejson
 from common.models import UserChannel
-from maps.models import Story
+from maps.models import Story, UserProfile, GroupProfile, MapTemplate
 
 def setup_first_user(request):
     if not User.objects.filter(username="admin").count():
         user.is_staff = True
         user.is_superuser = True
         user.save()
+        template = MapTemplate()
+        template.name = "Default"
+        template.save()
+        group = GroupProfile()
+        group.name = "All"
+        group.manager = user
+        group.default_template = template
+        group.save()
+        profile = UserProfile()
+        profile.user = user
+        profile.group_profile = group
+        profile.save()
         return HttpResponse("First user created")
     else:
         return HttpResponse("User already exists")