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

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ต.ค. 2024
  • In this video, we will look at User Pages based on Permissions. We will learn how to build user specific pages that must be rendered for a logged in user based on permissions the user is assigned to. By so doing, an Admin and a User will have a different pages for their index page page. The source code to the project is in the link below. Also the code for the templates are included
    Project Source Code:
    github.com/Ken...
    Dashboard Interface Design Source Code:
    github.com/Ken...
    Follow me on:
    Twitter: / kenbroni
    Facebook: / kenneth.broni.9
    Python Official website:
    www.python.org...
    Download and Install Python on Windows 10 Computer
    • Download and Install P...
    Python Programming | Series Tutorial
    • Python Programming | S...
    Bootstrap4.5 Series Tutorial
    • Bootstrap 4.5 | Series...
    #InventoryManagementSystem
    #Python
    #Django

ความคิดเห็น • 28

  • @gavd
    @gavd 2 ปีที่แล้ว +7

    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 ปีที่แล้ว +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 ปีที่แล้ว +2

    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 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@nhuong360 Ah I see! Thanks for the info :)

  • @ramymounir1685
    @ramymounir1685 3 ปีที่แล้ว +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(...)

  • @bakhodirmirzakulov4456
    @bakhodirmirzakulov4456 ปีที่แล้ว

    Thank you brother, for excellent tutorial!

  • @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...

  • @samdesigncodes
    @samdesigncodes 2 ปีที่แล้ว +1

    Great ... thanks for putting out great content

  • @dinahmarieanimos-bsit
    @dinahmarieanimos-bsit ปีที่แล้ว

    very informative and useful, thanks.

  • @ivypayne9114
    @ivypayne9114 3 ปีที่แล้ว +2

    This is wonderful

  • @uliseshuesca1407
    @uliseshuesca1407 2 ปีที่แล้ว +1

    What's the difference between login_required and Loginrequiredmixing? or is just diferent approach for the same thing?

    • @KenBroTech
      @KenBroTech  2 ปีที่แล้ว +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.

  • @alial-nuaimi2695
    @alial-nuaimi2695 2 ปีที่แล้ว +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 ปีที่แล้ว +1

      he did everything from scratch, check out his frontend video of this project

  • @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

  • @sushilsonawane4280
    @sushilsonawane4280 4 หลายเดือนก่อน

    my login_requrired is not working after applying login url also still it's accessible through the url's directly.

  • @zackdaspy357
    @zackdaspy357 3 ปีที่แล้ว +2

    Awesome 😎

  • @4uxion
    @4uxion 3 ปีที่แล้ว +2

    Hie fam. I seem to have encountered a "You are not authorized to view this page" message on the admin dashboard.

    • @KenBroTech
      @KenBroTech  3 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@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 ปีที่แล้ว +3

    I get sad every time the video ends :D

  • @centralcodingethiopia
    @centralcodingethiopia ปีที่แล้ว

    Thanks

  • @ThePercivalGlyde
    @ThePercivalGlyde 3 ปีที่แล้ว

    Great !

  • @godfredagyei6020
    @godfredagyei6020 2 ปีที่แล้ว +1

    Log in with Godfred next time