def create_user_profile(sender, **kwargs):
 user = kwargs['instance']
 if (not UserProfile.objects.filter(user=user)):
  UserProfile(user=user).save()

def create_user_profile ( sender , ** kwargs ) : user = kwargs [ 'instance' ] if ( not UserProfile . objects . filter ( user = user ) ) : UserProfile ( user = user ) . save ( )
when creating a new user .