Commits

Anonymous committed c767f70

create profile after invite user

  • Participants
  • Parent commits 9504c7e

Comments (0)

Files changed (1)

File maps/models.py

 from django.db import models
 from django.utils.translation import ugettext as _
 from datetime import datetime
+from registration import signals
 
 
 def model_to_dict(model):
     def to_dict(self):
         return model_to_dict(self)
 
+
+def create_user_profile(user, request, **kwargs):
+    profile = UserProfile.objects.create(user=user)
+
+    map_id = request.REQUEST.get('map_id', False)
+    map = Map.objects.get(id = map_id)
+    profile.group_profile = map.group_profile
+    profile.save()
+
+signals.user_registered.connect(create_user_profile)