Django Tutorial #10 - Authentication

Sdílet
Vložit
  • čas přidán 20. 06. 2024
  • In this Django tutorial series, you'll learn what Django is, how to setup a Django project, and how to use it to make a full web application, complete with a database and authentication.
    🚀🥷🏼 Check out Bek Brace's channel for more of his content:
    / @bekbrace
    🔥🥷🏼Get access to premium courses on Net Ninja Pro:
    netninja.dev/
    📂🥷🏼 Access the course files on GitHub:
    github.com/BekBrace/django_co...
    🧠🥷🏼 HTML Crash Course
    • HTML & CSS Crash Cours...
    🧠🥷🏼 Python Crash Course
    • Python Crash Course #1...
    🔗🥷🏼 Django docs:
    docs.djangoproject.com/en/5.0/

Komentáře • 13

  • @muhammadradwan74
    @muhammadradwan74 Před měsícem +5

    First of all thanks for your great efforts delivering this course, waiting for other courses and thanks for the NetNinja to support other Devs. At the beginning of this video you said that this is the last chapter of this course, but at the first part of this tutorial you said that at the end you will build an "Inventory Management System", so are there upcoming videos or this is really the last chapter?

  • @pdevdat
    @pdevdat Před měsícem +2

    This was the best Django course I found on CZcams that was quick and easy to understand. Thanks a lot! :)

    • @NetNinja
      @NetNinja  Před měsícem +1

      Happy to hear that! :)

  • @henrymatola592
    @henrymatola592 Před měsícem +2

    @NetNinja can you make a tutorial on OOP in Typescript/React 🙏🏽🥺
    ....and .NET 6😁
    Thank you❤️🙌🏽🌹

  • @black2thepiink
    @black2thepiink Před měsícem

    Tq bro 🙏

  • @artiphoria
    @artiphoria Před měsícem

    @54:14 Did anyone understand this very interesting part? 😵

  • @skewd2528
    @skewd2528 Před 21 dnem +1

    This one was really confusing, I think fully creating the register page first would be easier to understand

  • @mtpcess
    @mtpcess Před měsícem +1

    Only apiece 😊😊😊

  • @elshadsabziyev
    @elshadsabziyev Před 7 dny

    i was following up the tutorial and overall until this video everyting was fine. But this one is a bit confusing things are done differenlty especialy with routing and classes

  • @luiskingsleytolentino8291

    there is error in your code and you don't show the video to fix it, I let AI help me to fix it

    • @SamuelSibarani-nf9vx
      @SamuelSibarani-nf9vx Před dnem

      what kind of error, importing the views?

    • @ohadamsellem-kj6od
      @ohadamsellem-kj6od Před dnem

      @@SamuelSibarani-nf9vx
      # Fixed login_view Function:
      def login_view(request):
      error_message = None #---------------------------------------- If the request method is not "POST", error_message is not defined, So Define it as we do here.
      if request.method == "POST":
      username = request.POST.get("username")
      password = request.POST.get("password")
      user = authenticate(request, username=username, password=password)
      if user is not None:
      login(request, user)
      next_url = request.POST.get('next') or request.GET.get('next') or 'home'
      return redirect(next_url)
      else:
      error_message = "Invalid Credentials"
      context = {'error': error_message}
      return render(request, 'accounts/login.html', context )

    • @ohadamsellem-kj6od
      @ohadamsellem-kj6od Před dnem

      also, login.html body should look like this:

      Login

      {% csrf_token %}
      {% comment %} hidden input {% endcomment %}


      Username



      Password


      Login

      {% if error %}
      {{ error }}
      {% endif %}
      Don't have an account? Register Here

      #-------------------------------------#
      And the styles.css should look like this:
      body{
      font-family: Arial, sans-serif;
      background-color: #f4f4f4;
      margin: 0;
      padding: 0;
      justify-content: center;
      align-content: center;
      display: grid;
      height: 100vh;
      }
      .container{
      background: #fff;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
      }
      h2{
      margin-bottom: 20px;
      }
      .form-group{
      margin-bottom: 15px;
      }
      label{
      display: block;
      margin-bottom: 5px;
      }
      input[type="text"],
      input[type="password"] {
      width: 100%;
      padding: 8px;
      box-sizing: border-box;
      }
      button{
      background: #007bff;
      color: #fff;
      border: none;
      padding: 10px 20px;
      cursor: pointer;
      border-radius: 6px;
      }
      button:hover{
      color: red;
      margin-top: 10px;
      }
      .error{
      color: red;
      margin-top: 10px;
      }