I’m building a website using Django. I have the register and login sessions working, so any user can create an account and login. But now I want a situation whereby when someone creates an account, the account will be inactive and pending until the admin accepts the user. However, I haven’t implemented any code that does that before and I want to know if Django has a built-in package for that. If not, how do I go about it?
Advertisement
Answer
If you are using a default User
model of Django at time of create user, save it like these:
user = User.objects.create_user( first_name = first_name, last_name = last_name, email = email, password = password, username = username, is_active = False ) user.save()
and by using filter query list all inactive users to admin.