Django: Getting Started Transcripts
Chapter: Django Admin
Lecture: Django users
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
I mentioned in the intro that I'd have to take a little detour to talk about users, here is that detour. Django has three basic classes of users.
0:10
The admin or super user. The terminology actually is a bit inconsistent.
0:17
Staff, these are users who aren't quite super users but have access to the Django admin. This gives you two levels of control out of the box
0:26
and then normal typical everyday users, not that you should judge them. The difference between these user types is indicated
0:33
by the presence of two billions on the user profile. A flag for admin and a flag for staff.
0:40
Best practice is to make all admin staff and both billions being false means a regular user.
0:45
There is a login wall in front of the Django admin and by default only those users who have the staff or admin flag turned on
0:54
are authorized to use the tool. Django actually has a whole other user group permission structure that gives fine grain control if you so desire.
1:03
The staff/normal user division is often good enough for most purposes though. To use the admin, you're going to need a super user account.
1:12
Let's go use a management command to create one. I'm in my terminal shell the management command I want is create super user.
1:25
It prompts me for a user name. The typical one is to use admin, then an email address.
1:33
It doesn't verify this. You can use anything that is a valid looking address. Then a password.
1:39
Then to make sure you can type the same thing twice in a row It asks you again. And then in my case it yells at me because
1:47
I used a totally insecure password. Inside of settings.py, you can control exactly what password validators you use.
1:57
Or you can do like I am here and tell the create super user command, it's all good, admin is a perfectly acceptable password for the admin account.
2:06
Please don't do this in production. And that's it. You now have a super user account.