I've write in my project: def create_profile_for_user(sender, instance, signal, *args, **kwargs): try: User.objects.get(id=instance._get_pk_val()) except (User.DoesNotExist, AssertionError): profile = Profile( user = instance ) profile.save()
dispatcher.connect(create_profile_for_user, signal=signals.post_save, sender=User) it creates a profile for new user. works On Feb 10, 6:09 am, "Benjamin Slavin" <[EMAIL PROTECTED]> wrote: > Howdy all, > > I was investigating post_save to perform some associated setup for an > object after it's created. My only concern is that I can't seem to > find any way to check if the object was created on this call to > save()... I only want to perform the setup the first time the object > is saved. > > So... Is it possible to perform a function (via post_save or some > other mechanism) when a given object is saved for the first time? > > Perhaps the addition of a post_create signal could be a solution, but > I didn't want to bring that up on django-developers until I asked > here. > > Thanks, > -Ben --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---