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:
JavaScript
x
10
10
1
user = User.objects.create_user(
2
first_name = first_name,
3
last_name = last_name,
4
email = email,
5
password = password,
6
username = username,
7
is_active = False
8
)
9
user.save()
10
and by using filter query list all inactive users to admin.