Django: Getting Started Transcripts
Chapter: Users and Account Management
Lecture: Chapter concepts
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
This chapter is all about your website interacting and managing user accounts.
0:05
Django provides a lot of tools for this but it requires a bit more customization than some of the other parts.
0:11
If you're building anything with user interaction, there's a good chance you're going to need to manage user accounts.
0:17
That includes things like managing login and logo pages, controlling access to your views and managing the user data and account passwords.
0:27
In this chapter, I'll also touch a bit on customizing error pages. Users trying to go places they're not supposed to go,
0:34
result in a variety of different errors. You may want yours to be pretty at least. In the previous chapter I introduced you to the Django admin.
0:43
Big part of that site is user management. Users are just a special form of data and the admin gives you control.
0:51
What about the attributes associated with your users? The user class in Django has an attribute for user name, email, first name, and last name.
0:59
Your needs might be more than that. To deal with this, Django also provides a couple of different ways of augmenting this data.
1:06
The first mechanism is a user profile object. This is a model class for attributes managed like pretty much any other model class.
1:15
The only special thing about it is it has a 1-1 relationship with a user model class.
1:19
This kind of relationship means there's a shortcut from the user object to the
1:24
profile, making it a short step from the authenticated user in the request to their augmented dataset.
1:31
The other alternative is you can replace Django's built in user model with your own. There's a lot more work for this, but it can be powerful.
1:39
If you want to use email address as the login field instead of user name, for example, this is how you would achieve that.
1:46
Let's take advantage of the Django admin and create a user through the tool.