I want to implement django signals on User model for create user profile. I want to create user profile when any user will be created. here is my code for create user profile though signals:
from django.contrib.auth.models import User
@receiver(post_save, sender=User)
def user_is_created_or_save(sender,instance,created,**kwargs):
user = instance.user
first_name = instance.first_name
last_name = instance.last_name
if created:
UserProfile.objects.create(user=user)
I am not understanding why user profile not creating when I am creating any user. Assume I created an user from django admin panel so it should be create an profile for user but it’s not creating any user profile.