Django Multiuser Registration and Login based on Role

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello youtube this is mr django today we're going to see a relevant system a login system using the jungle framework okay let's get started as you can see i have created a project named rule based login system and also i have made some templates and also i have added the static files for the templates so let's get started first let's create an app so item management ui start up let's call our account here you can see our account up the next thing we're going to do is go to the city and add our app in the installed apps and after that we are going to create python file we need to use urls and also we are going to go to the main project url and include that url [Music] there [Music] next let's copy the url file and add it to our account url and also let's create some palettes for now [Music] [Music] or create our model but so before that we want to extend our user model using the abstract order abstract user so let's import it and then let's name our class theodore and abstract user after that let's add the roles we want to use in our project so is admin is one word the next role will be is customer and last one will be is employee so i'm going to divide my healer into three rows and based on the world they can log into different webpages and so on and after finishing our url we need to go our model we need to go to the setting and change the out user model to the model we have created now so first we write our app name next the model yeah that's how we change so next let's make migration for our model and so let's migrate the model okay now let's let's run our project and see what it looks like this is the index page where there is a login and registration button so now let's go back to our app and create the python form files and let's create a form for the login and also for the registration so for the login we have for the registration we need the the user question form [Music] okay now let's write the form for the login login form and the login form takes in the username password [Music] [Music] hit next for the sign up for registration form uh we're going to use the user creation form okay and let's just copy the top username and password and also place our mouse and let's create a class data and specify the model we're using we're using the user model and also let's specify the fields we are going to use [Music] okay the next thing we're going to do is let's create the views so the first we will be creating is the registration view so you can see the cards below [Music] [Music] [Music] [Music] and then the next view we'll be creating is the log [Music] view [Music] [Music] [Music] [Music] [Music] [Music] okay now we have created the login and registration views and also we have created a home the home view which is used just to see after login is successfully done it should go to a home page so let's change the url of the index page to the login and registration page and let us see let us see how it looks like so let's register first of all i haven't okay [Music] here you can see i have made the roll of the jungle as an admin and let's login here we have logged into the home page okay [Music] okay let's register the model in the admin side and let's create this argue there [Music] okay let's go to the admin page and see the users we have played here you can see we we have two users the jungle and also mama you can see the jungle is an arduino let's log in again again let's watch other users we have registered allen as a customer and again let's register another user line chat again [Music] this user we have registered it as an employee let's go to the admin page and see the users here are our users as you can see is an employee alan is a customer and so on okay the next thing we're going to do is it creates an individual page for every users for customers customer page and for employee the employee page and so on [Music] [Music] and let's go back to our [Music] our views and let's make some adjustments so we are planning to make it a role-based login which means if a user is a customer it has to go to the customer page if the user is employed to the employee page and so on [Music] [Music] so we go to the view and also we have the login view and here it says if user is not now and if user dot is admin then thank it to the admin page and so on again i'll see if if the user is an employee we'll take it to the employee page and so on [Music] so now let's log out of the admin page and let's see how it's going to take us so here is django he's an admin when we log in it says hello jungkook your role is admin as you can see under title it's in the admin page okay again let's go to the island alain is also a customer and so our launcher employee so [Music] okay anyone interested in the card you could find it in the description below there is a github link and also don't forget to like and subscribe and also comment me a project you would like to see in the future thank you very much
Info
Channel: Mr. Django
Views: 2,949
Rating: undefined out of 5
Keywords: Dango, introduction to django, django frame work, django web framework, python, django python framework, django usercreation, multiple user registration, multiple user login, multiple user login and registration django, multiple user login and registration django framework, multiple user login in django, multiple user login and registration in django
Id: bTFRbAuU5Uo
Channel Id: undefined
Length: 19min 5sec (1145 seconds)
Published: Tue Jun 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.