diff --git a/core/signals.py b/core/signals.py index df3bb1f7..8cec4738 100644 --- a/core/signals.py +++ b/core/signals.py @@ -16,17 +16,19 @@ def facebook_extra_values(sender, user, response, details, **kwargs): pre_update.connect(facebook_extra_values, sender=FacebookBackend) -def create_wishlist(sender, created, instance, **kwargs): +def create_user_objects(sender, created, instance, **kwargs): # use get_model to avoid circular import problem with models try: Wishlist = get_model('core', 'Wishlist') + UserProfile = get_model('core', 'UserProfile') if created: Wishlist.objects.create(user=instance) - + UserProfile.objects.create(user=instance) except DatabaseError: # this can happen when creating superuser during syncdb since the # core_wishlist table doesn't exist yet return + -post_save.connect(create_wishlist, sender=User) +post_save.connect(create_user_objects, sender=User) post_save.connect(create_api_key, sender=User) diff --git a/frontend/views.py b/frontend/views.py index d83de13d..db1adba0 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -79,11 +79,7 @@ def supporter(request, supporter_username): # following block to support profile admin form in supporter page if request.user.is_authenticated() and request.user.username == supporter_username: if request.method == 'POST': - try: - profile_obj=request.user.get_profile() - except ObjectDoesNotExist: - profile_obj= models.UserProfile() - profile_obj.user=request.user + profile_obj=request.user.get_profile() profile_form = ProfileForm(data=request.POST,instance=profile_obj) if profile_form.is_valid(): profile_form.save()