code: def create_user_profile(sender, instance, created, **kwargs):
      
      if created:
          profile = UserProfile.objects.get_or_create(user=instance)[0]
          profile.hash_pass = create_htpasswd(instance.hash_pass)
          profile.save()
      else:
          # update password
          try:
              up = UserProfile.objects.get(user=instance.id)
              up.hash_pass = create_htpasswd(instance.hash_pass)
              up.save()
          except AttributeError:
              pass
docs: Create the UserProfile when a new User is saved