Answer the question
In order to leave comments, you need to log in
How to set an action when creating a user in Django?
It is necessary that after each creation of a new user User, my function is called. Is it possible to implement this?
Answer the question
In order to leave comments, you need to log in
Depends on your requirement. There is more than one way to do this.
If you create users yourself (without using django-allauth and similar libraries), in one view, then it is enough to perform an action in this view.
Otherwise, you can either override the save method of your user class (I hope you're not using the idiotic crutch with Django's built-in django.contrib.auth.models.Users class and its associated Profile, but use your user model), or use a signal like , post_save.
In the case of using django-allauth, it has its own signals and hooks to implement such functionality.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question