@receiver(post_save)
def create_profile(sender, instance, created, **kwargs):
 if (sender == get_user_model()):
  user = instance
  profile_model = get_profile_model()
  if ((profile_model == UserProfile) and created):
   (profile, new) = UserProfile.objects.get_or_create(user=instance)

@ receiver ( post_save ) def create_profile ( sender , instance , created , ** kwargs ) : if ( sender == get_user_model ( ) ) : user = instance profile_model = get_profile_model ( ) if ( ( profile_model == UserProfile ) and created ) : ( profile , new ) = UserProfile . objects . get_or_create ( user = instance )
create a matching profile whenever a user object is created .