Merge branch 'master' of github.com:Gluejar/regluit into goodreads
commit
7c645886bd
|
@ -16,17 +16,19 @@ def facebook_extra_values(sender, user, response, details, **kwargs):
|
||||||
pre_update.connect(facebook_extra_values, sender=FacebookBackend)
|
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
|
# use get_model to avoid circular import problem with models
|
||||||
try:
|
try:
|
||||||
Wishlist = get_model('core', 'Wishlist')
|
Wishlist = get_model('core', 'Wishlist')
|
||||||
|
UserProfile = get_model('core', 'UserProfile')
|
||||||
if created:
|
if created:
|
||||||
Wishlist.objects.create(user=instance)
|
Wishlist.objects.create(user=instance)
|
||||||
|
UserProfile.objects.create(user=instance)
|
||||||
except DatabaseError:
|
except DatabaseError:
|
||||||
# this can happen when creating superuser during syncdb since the
|
# this can happen when creating superuser during syncdb since the
|
||||||
# core_wishlist table doesn't exist yet
|
# core_wishlist table doesn't exist yet
|
||||||
return
|
return
|
||||||
|
|
||||||
post_save.connect(create_wishlist, sender=User)
|
|
||||||
|
post_save.connect(create_user_objects, sender=User)
|
||||||
post_save.connect(create_api_key, sender=User)
|
post_save.connect(create_api_key, sender=User)
|
||||||
|
|
|
@ -79,11 +79,7 @@ def supporter(request, supporter_username):
|
||||||
# following block to support profile admin form in supporter page
|
# following block to support profile admin form in supporter page
|
||||||
if request.user.is_authenticated() and request.user.username == supporter_username:
|
if request.user.is_authenticated() and request.user.username == supporter_username:
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
try:
|
|
||||||
profile_obj=request.user.get_profile()
|
profile_obj=request.user.get_profile()
|
||||||
except ObjectDoesNotExist:
|
|
||||||
profile_obj= models.UserProfile()
|
|
||||||
profile_obj.user=request.user
|
|
||||||
profile_form = ProfileForm(data=request.POST,instance=profile_obj)
|
profile_form = ProfileForm(data=request.POST,instance=profile_obj)
|
||||||
if profile_form.is_valid():
|
if profile_form.is_valid():
|
||||||
profile_form.save()
|
profile_form.save()
|
||||||
|
|
Loading…
Reference in New Issue