Fixed user profile not being created for new user

This commit is contained in:
fergalmoran
2013-04-25 11:48:24 +01:00
parent 3398f1c670
commit 06eef28843
3 changed files with 11 additions and 6 deletions

View File

@@ -0,0 +1 @@
import signals

View File

@@ -143,10 +143,4 @@ class UserProfile(_BaseModel):
return urlparse.urljoin(settings.STATIC_URL, "img/default-avatar-32.png")
def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user=instance)
post_save.connect(create_user_profile, sender=User)

View File

@@ -4,9 +4,11 @@ from django.db.models.signals import post_save
from django.dispatch import Signal
from kombu import Connection
from kombu.entity import Exchange
from django.contrib.auth.models import User
from dss import localsettings
from spa.models import _Activity
from spa.models import UserProfile
from spa.models.Mix import Mix
import pika
@@ -43,3 +45,11 @@ def send_activity_to_message_queue(sender, *args, **kwargs):
post_save.connect(send_activity_to_message_queue, sender=None)
def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user=instance)
post_save.connect(create_user_profile, sender=User, dispatch_uid="users-profilecreation")