Answer the question
In order to leave comments, you need to log in
How to programmatically assign a group to a user?
I have a problem, I can not find a user registration, in which, immediately upon registration, the user will automatically be assigned "Staff Status" and will write him to an existing group with his rights.
Please help, I've been struggling with this problem for a long time.
Answer the question
In order to leave comments, you need to log in
I'm afraid you will have to read about signals in jang for a long time and then take and stir up something terrible, like this
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question