def create_user_profile(sender, instance, created, **kwargs):
    """Create the UserProfile when a new User is saved"""
    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
Create the UserProfile when a new User is saved