User Pages based on Permissions | Django Inventory Management System Web Application

  Рет қаралды 24,520

KenBroTech

KenBroTech

Күн бұрын

Пікірлер: 28
@gavd
@gavd 2 жыл бұрын
One of the best thing of this guy is you can replicate every single step without problems, this encourage you to continue, Thanks Ken.
@sithuhtun3609
@sithuhtun3609 3 жыл бұрын
Sir, You should be proud of yourself. I've been looking for the user different permissions for two days long and I haven't found the right one until you.
@DrHappybone
@DrHappybone 3 жыл бұрын
Another fantastic video, brother! Loving the series! I have a question though (I'm about to go look at the docs).. The logic for the admin/staff bit seems like it shouldn't work but it does.. For example, I read "if user.is_authenticated and user.is_staff and user.is_superuser" as "if the user is authenticaed, and if they are staff, and if they are superuser"... Which would mean they have to be all 3 of these. Else "if they're not these three, show them this page 'dashboard/staff_index.html' ". In my mind, if you logged in as staff, the if statement should fail because you;re not superuser, only staff... But it somehow works out that you;re staff and gives you the staff page. In my mind it should be more like: "if user is authenticated and is staff" shows staff page "if user is authenticated and is superuser" show admin page "else" show.. some kind of access denied page or something. I don't understand how this if statement is able to still run when all 3 conditions are not met and then show the staff page under the "else" clause.. I'm not sure you'll be able to explain this in the space of a comment here but maybe you could link me to some docs or somewhere that I can get my head around it? Thanks again for the awesome videos!
@nhuong360
@nhuong360 2 жыл бұрын
the reason why it works is because if user.is_superuser is True, then the rest will be true (Because of the hierarchy, super_user > Staff).
@DrHappybone
@DrHappybone 2 жыл бұрын
@@nhuong360 Ah I see! Thanks for the info :)
@ramymounir1685
@ramymounir1685 3 жыл бұрын
Thank you, very nice tutorial. I figured we can also redirect unauthorized users in the view method instead like this: user = User.objects.get(username=request.user) if not user.is_staff: return HttpResponseRedirect('/logout') else: render(...)
@kellcyrus3713
@kellcyrus3713 2 жыл бұрын
thanks for the content.it contributed to my final year project. Keep up the good work. I wish you uploaded the products with their images...
@sushilsonawane4280
@sushilsonawane4280 4 ай бұрын
my login_requrired is not working after applying login url also still it's accessible through the url's directly.
@samdesigncodes
@samdesigncodes 2 жыл бұрын
Great ... thanks for putting out great content
@bakhodirmirzakulov4456
@bakhodirmirzakulov4456 Жыл бұрын
Thank you brother, for excellent tutorial!
@alial-nuaimi2695
@alial-nuaimi2695 2 жыл бұрын
Hi brother, How are you ? I'd like to thank you for this simple video about handling user permissions, you just mad it so simple and easy , but accept this from me please , if u want ppl to learn don't copy and past staff such as frontend please do every thin from scratch and ur font size little big. please let me know how I can send money for you m8. thanks a lot 10/10.
@justin9494
@justin9494 Жыл бұрын
he did everything from scratch, check out his frontend video of this project
@ivypayne9114
@ivypayne9114 3 жыл бұрын
This is wonderful
@mohammedkhalifa5822
@mohammedkhalifa5822 Жыл бұрын
Django - login_required not redirecting in chrom but it works in edge why it so I have also tried to clear cache from the browser
@dinahmarieanimos-bsit
@dinahmarieanimos-bsit Жыл бұрын
very informative and useful, thanks.
@uliseshuesca1407
@uliseshuesca1407 2 жыл бұрын
What's the difference between login_required and Loginrequiredmixing? or is just diferent approach for the same thing?
@KenBroTech
@KenBroTech 2 жыл бұрын
The login_required decorators are used on function based views while the Mixins are used for class based views. However, they serve the same purpose.
@zackdaspy357
@zackdaspy357 3 жыл бұрын
Awesome 😎
@4uxion
@4uxion 3 жыл бұрын
Hie fam. I seem to have encountered a "You are not authorized to view this page" message on the admin dashboard.
@KenBroTech
@KenBroTech 3 жыл бұрын
Kindly check the permissions. In the work, I have a couple of Users of whom 1 is an Admin. The Admin is the one I created as a superuser from the terminal. It is only the User with super user status that can view the admin dashboard.
@4uxion
@4uxion 3 жыл бұрын
@@KenBroTech when i created my superuser i assigned all permissions so when im on the dashboard i can add products but i cannot delete and edit. Thats where the error is. For the staff dashboard everythng is fine
@KenBroTech
@KenBroTech 3 жыл бұрын
@@4uxion Do a makemigration and then migrate. I'm sure some of the models haven't related well
@4uxion
@4uxion 3 жыл бұрын
@@KenBroTech i figured it out. I had made a mistake with my view for authorized user function... Also forgot to makemigrations. Thanks a lot man. Much love for your channel. Good day
@mertlinux
@mertlinux 3 жыл бұрын
I get sad every time the video ends :D
@centralcodingethiopia
@centralcodingethiopia Жыл бұрын
Thanks
@ThePercivalGlyde
@ThePercivalGlyde 3 жыл бұрын
Great !
@godfredagyei6020
@godfredagyei6020 2 жыл бұрын
Log in with Godfred next time
Django Permissions | Model Level | Views and Templates
23:30
Very Academy
Рет қаралды 18 М.
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 269 #shorts
00:26
小丑揭穿坏人的阴谋 #小丑 #天使 #shorts
00:35
好人小丑
Рет қаралды 10 МЛН
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 93 МЛН
Login and Logout - Django Wednesdays ECommerce 7
20:33
Codemy.com
Рет қаралды 15 М.
Django Login Form and User Authentication
17:01
Dave Gray
Рет қаралды 15 М.