Something similar is happening with me too: on a post_save of model it 
isn't created yet on database, so several 
error are raised by functions which expect that it is already on DB.

When the post_save handler ends, the object is saved normally.


On Friday, January 16, 2015 at 4:14:09 PM UTC-2, Zach LeRoy wrote:
>
> I have a block of code that works fine in Django 1.6.10 but does not work 
> at all in Django 1.7.3.  I would expect my log statement to print every 
> time a Django User is created and this is the behavior in 1.6.10:
>
> import logging
>
> from django.contrib.auth.models import User
> from django.db import models
> from django.db.models.signals import post_save
> from django.dispatch import receiver
>
> log = logging.getLogger(__name__)
>
>
> class UserProfile(models.Model):
>     uuid = models.CharField(max_length=36)
>     user = models.OneToOneField(User)
>
>
> @receiver(post_save, sender=User)
> def create_user_profile(sender, instance, created, **kwargs):
>     """
>     When a new user is created, add a UserProfile
>     """
>     log.debug('received post save signal: {}'.format(instance))
>     if created:
>         UserProfile.objects.create(user=instance)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2aa39e20-a977-436c-9e21-586605ec7df6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to