Django Authentication Basics

Поділитися
Вставка
  • Опубліковано 3 лют 2025

КОМЕНТАРІ • 131

  • @prettyprinted
    @prettyprinted  5 років тому +2

    Join my free course on working with the database and models in Django: prettyprinted.com/djangodata

  • @CrackerWeb
    @CrackerWeb 3 роки тому +1

    Very strait forward explainers, great.
    16:45 this is very important step you explain in just 2-3 second, I bet most of the people miss that

    • @dillibabu4757
      @dillibabu4757 Рік тому

      Will u help me
      I have error in login page
      He was not create login page path so how it was run pls reply me 😢

  • @haroldpepete
    @haroldpepete 4 роки тому

    Great, straight to te concept and example, you earn a new subscriber

  • @MrEdersonlima
    @MrEdersonlima 7 років тому +1

    Omg, these videos are really helping me a lot, please continue with these videos with django, they're excellents!!!

    • @prettyprinted
      @prettyprinted  7 років тому +1

      I'm glad they're helping you. Thanks for watching.

  • @mzgz4216
    @mzgz4216 7 років тому +2

    cant wait to see you upcoming videos

  • @robinkovacic7961
    @robinkovacic7961 4 роки тому

    Very good explanation, really helped me understand how django auth works. Thank you!

  • @axiomvp7808
    @axiomvp7808 7 років тому +4

    Best login tut i have found on django and iv watched a few now. Most use bs methods. Please do that detailed video you spoke about :)

    • @prettyprinted
      @prettyprinted  7 років тому

      Thanks! I'll definitely make that video soon.

  • @Asgallu
    @Asgallu 3 роки тому

    Great video!

  • @fmkikomina
    @fmkikomina 4 роки тому

    Nice video, I was looking for that future video, couldn't find it

  • @srajanjain3220
    @srajanjain3220 3 роки тому

    Really amazing explanation!
    Thanks.

  • @alialkhulaifi2423
    @alialkhulaifi2423 3 роки тому

    Awesome Explanation! Thanks alot :)

  • @OthmaneLh001
    @OthmaneLh001 7 років тому

    this was the hardest video to understand but I did it and I understand it, Thank you Anthony :)

    • @prettyprinted
      @prettyprinted  7 років тому +1

      Glad you understood it. Thanks for watching.

  • @bhushanpathrikar6045
    @bhushanpathrikar6045 4 роки тому

    Damn great plz keep making video on entire django

  • @gonzalomcordovez
    @gonzalomcordovez 4 роки тому

    fantastic video, thank you so much man :)
    helped me a lot

  • @SimonYells
    @SimonYells 4 роки тому +1

    A perfect tutorial. Thanks !

  • @antina314
    @antina314 6 років тому +1

    Great job! :) Nice introduction to django auth.

  • @michaelkennedy5126
    @michaelkennedy5126 6 років тому +1

    thanks for making this tutorial, very useful

    • @prettyprinted
      @prettyprinted  6 років тому +1

      You're welcome! Thanks for watching.

  • @giridharjadala2182
    @giridharjadala2182 3 роки тому

    totally worth it !!!

  • @TomislavMiletic
    @TomislavMiletic 4 роки тому

    Do you have a video with more details on authentication?

  • @letoan285
    @letoan285 7 років тому +1

    Looking forward to your next videos with Django 2.0++. could you please make video with path parameters as slug/id ?

    • @prettyprinted
      @prettyprinted  7 років тому

      That's a good idea for a video. I'll see what I can do.

  • @matrixdexter270
    @matrixdexter270 6 років тому +1

    you should do a chartjs and django combo..everybody has been searching for this with a good explanation. you give the best anyway.kindly share the sourcecode

    • @prettyprinted
      @prettyprinted  6 років тому

      I'll consider that. Thanks for the idea.

  • @muralidhar40
    @muralidhar40 2 роки тому

    06:35 What does {%if next%} in jinja2 do?

  • @jackli2530
    @jackli2530 5 років тому +3

    hi, this is a brief but good lesson, however, I'm confuse in code "if next" in index.html, I try google but still stuck, would u please get me a hint? thanks

    • @Ryuuun
      @Ryuuun 4 роки тому

      next is a variable in the URL that holds the page user trying access but if you put @login_required above the function in views.py, then the user would be redirected to login page to login before being able to access the original page.
      say if I want to visit example.com/profile but I need to log in to view the page
      django will redirect me to /accounts/login?next=example.com/profile
      once you login djang then redirects you the the next URL which is profile.
      hope that's helpful, happy coding!

    • @omparikh4426
      @omparikh4426 4 роки тому

      Ryan Hu does this redirect if have some REDIRECT_URL in settings.py ?

  • @derekkroeker4582
    @derekkroeker4582 3 роки тому

    How to make login form for different types of user positions?

  • @chawza8402
    @chawza8402 4 роки тому

    what does authenticate() does? I use the similar way as you do but in login view. but the authenticate() function always return None. when should I authenticate the user? in the Login or registration? on my site after registraion, I want the user to go back to the login.html

  • @dellapatricia8955
    @dellapatricia8955 4 роки тому

    Hi, my registration form is not showing on my registration page. Could you tell me why?

  • @АнатолийЮров-ж9л
    @АнатолийЮров-ж9л 3 роки тому

    An interesting proposal is possible, but it is not so easy to understand all this without knowing the language. Moreover, it is necessary to take into account my knowledge and ability to use all the possibilities of the presented program. But the ability to work on a computer is also important.

  • @xtremehackerzpro9511
    @xtremehackerzpro9511 7 років тому +2

    Great video again, Django also provides custom backend auth, for example, email auth... please make next video about authorization (permission groups) :-)
    Pss.. else after return redirect is unnecessary ;)

    • @prettyprinted
      @prettyprinted  7 років тому +1

      Yeah, you're right about the else. In my mind I was thinking explicitly about difference between GET and POST, but if it's a GET request, the POST block wouldn't be run.
      I'll definitely cover authorization. Thanks for the idea.

  • @kutluaydn1508
    @kutluaydn1508 3 роки тому

    I have custom user model. How can I authenticate for it?

  • @mayanktripathi4u
    @mayanktripathi4u 4 роки тому

    Hi, Could you please share some detail or video tutorial on how to handle multiple user types.
    For an example... a group of people (like Managers) has access to approve leaves of group of people (like Employee).
    I mean Managers has access to Approve.. where as Employee will not have. They can just apply for leave.

  • @sidyka6568
    @sidyka6568 6 років тому

    Wao great video Pretty Printed. Thank for this instructive video.

    • @prettyprinted
      @prettyprinted  6 років тому

      You're welcome! Thanks for watching.

  • @faraazali9589
    @faraazali9589 4 роки тому

    how do you authenticate with active directory user credentials?

  • @NikitaDharmadhikariNikki
    @NikitaDharmadhikariNikki 4 роки тому

    is there any way to activate users account via an activation email?

  • @gautampramod1734
    @gautampramod1734 4 роки тому

    Hey .. when u move to the admin page.. u were logged out of admin..saying u are not staff. Coz the user we created was is_active=true.. and i thik all usr from login is same.. how to get rid of such screen in the admin panel.. and when u group the user i think its not possible for evrtym when new user registered wil be grouped by admin.. i need help please.. i want to do the project😭😭😭

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 6 років тому +1

    thanks for this tutorial sir :) keep it up

  • @sisyphus_619
    @sisyphus_619 7 років тому

    thank you very much. i look forward to your next videos.
    are you going to do a tutorial on React and Django?

    • @prettyprinted
      @prettyprinted  7 років тому +1

      React will be sometime in the future, yes. Once I cover it, I'll cover it with Django and other backend frameworks.

    • @SimpleUEisBetterThenComplex
      @SimpleUEisBetterThenComplex 5 років тому

      www.udemy.com/course/react-django-full-stack/?referralCode=83F5A09B826E1F532E4D

  • @victorfariaaa
    @victorfariaaa 5 років тому

    Is it mandatory to use the django's default authentication users table for a project? I mean, if I want to a separate table for my users instead, is this possible? Using the same table that manage the admin users couldn't be a security issue? Thanks. Your videos are awesome.

    • @prettyprinted
      @prettyprinted  4 роки тому

      You don't have to use the default table. But I don't think it's a security issue to use it.

  • @eneko4562
    @eneko4562 5 років тому

    Could I change the language for example ,to spanish ,of all those help messages if I wanted? what do I have to do?

  • @mr.samarthahegde5785
    @mr.samarthahegde5785 5 років тому

    You are using function based views, how to make authentication with class based views and without django templates? what i mean to say is HTML pages should not define in django project instead make it available outside the project and access it by AJAX, is it possible?

  • @sunilrajput5149
    @sunilrajput5149 4 роки тому

    it's really helpful, thanks :)

  • @tripathi5174
    @tripathi5174 5 років тому

    Sir what if we have a admin and I want to delete that admin and create a new superuser, will all the data of my project or website will be lost or the actions performed by the previous admin will be lost?
    or there will be no change at all if i create a new super user with different name and password please help i am not able to access my previous admin and i am getting an error called as
    User.profile.RelatedObjectDoesNotExist: User has no profile.
    Please reply sir

  • @mzgz4216
    @mzgz4216 7 років тому +6

    Anthony thank you very much. your videos in django2 are the best on youtube . man how about custom authentication . what if i want to register users with phone numbers or email ?

    • @prettyprinted
      @prettyprinted  7 років тому +4

      I'm going to cover that as well. I just don't want the videos to be too long covering a single topic.

    • @mzgz4216
      @mzgz4216 7 років тому

      Pretty Printed man i wish you accept my friendship . your efforts are appreciated by all of us . and uli wonder why you didnt start with django tutorials long time ago . im waiting for you videos . i wish to ask you .. how you see jobs demand for django developers . man i tried with php and asp with no success . and i found that my mind only accept python . tell me your thoughts ..

    • @prettyprinted
      @prettyprinted  7 років тому +1

      There are plenty of jobs for all of the popular frameworks.
      I don't know what it's like in your area, so I'd try talking to local programmers.

    • @mzgz4216
      @mzgz4216 7 років тому

      Pretty Printed what about remote jobs .. do you think remote jobs would enough for a man to sattled ..

    • @prettyprinted
      @prettyprinted  7 років тому +2

      Oh yeah, I'm sure there are plenty of remote jobs for any stack you write code for, but I imagine it's harder to get a remote job.

  • @varunsharma2200
    @varunsharma2200 5 років тому

    Its really helpful. Thanks

    • @prettyprinted
      @prettyprinted  5 років тому

      Glad I could help. Thanks for watching!

  • @AjitKumar-ul2ku
    @AjitKumar-ul2ku 5 років тому

    hii , i have to get logina and logout time for the user through signals or any other way please help me

  • @mateuscastanho7202
    @mateuscastanho7202 4 роки тому

    how can I add some botstrap on the input ???

  • @juliavanderkris5156
    @juliavanderkris5156 6 років тому +5

    Holy shit, Django is so awesome! Thanks for this tutorial, dude!
    Just one thing: is there an easy way to add more information to the user table? Like settings and stuff like that.

    • @prettyprinted
      @prettyprinted  6 років тому +1

      One way is to create another table that will have a relationship to the user table. I'll probably make a video on that in the future.

  • @raoufm2428
    @raoufm2428 6 років тому

    Thank you so much you saved my life

  • @dude-ox2em
    @dude-ox2em 4 роки тому

    Register works fine for me but login fails hehat to now?? pls help me out Anthony

  • @mdwaseemahmad4256
    @mdwaseemahmad4256 3 роки тому

    How "any user can't see another users posted data" in django?

  • @aldrinsaurovsarker5159
    @aldrinsaurovsarker5159 4 роки тому +2

    I wasted half of my day to find out why my login form isn't being shown and realized it won't show unless I write 'form = UserCreationForm()' in the views.login part.
    Idk why it worked for you ; maybe because of versions.

    • @B2EO
      @B2EO 3 роки тому

      i wasted 1 hour >.

  • @LexPodgorny
    @LexPodgorny 5 років тому

    Hello, thank you for your tutorials! They are very helpful. Question: I need to send a new user an invite link to registration with a temp password in it. How do I integrate temp passwords into this system?

  • @NiroKun23
    @NiroKun23 6 років тому

    Hey! Thanks to you i now can use authentication, but now i have some troubles with social media logins. I'm using this tutorial "allauth", but i can't do it. It seems that have troubles with some templates? Because i can't even login.

    • @prettyprinted
      @prettyprinted  6 років тому

      I do plan on making an allauth tutorial, so look out for that.

  • @sachinakula5088
    @sachinakula5088 6 років тому

    Hi I'm using google firebase as authentication. How can I pass firebase generated token to django auth or how can I check whether the user logged in through google firebase.
    Thank you

  • @dillibabu4757
    @dillibabu4757 Рік тому

    Bro without creating login page path how it was run😢

  • @OHOTOLEable
    @OHOTOLEable 7 років тому

    Could you make a video about signals?

    • @prettyprinted
      @prettyprinted  7 років тому +1

      I'll take that into consideration. Thanks for the idea.

  • @Raj_Patel21
    @Raj_Patel21 5 років тому

    Thanks for the video :)

    • @prettyprinted
      @prettyprinted  5 років тому

      You're welcome! Thanks for watching.

  • @satisharvapalli3457
    @satisharvapalli3457 6 років тому +1

    Thank you Anthony for your amazing stuff, can you help me to create virtual environment.

  • @jokessamp5438
    @jokessamp5438 4 роки тому

    ModuleNotFoundError: No module named 'authenticate.view'
    if someone can help me please ?

  • @rebekawa
    @rebekawa 6 років тому

    Hi, can I access you code somewhere? I don't find it in your git repositories

    • @prettyprinted
      @prettyprinted  6 років тому

      I usually don't host code for conceptual videos, but I do have all the code from my videos on my computer. If you want me to send it to you, just email me at anthony@prettyprinted.com

  • @marcelaguiar6815
    @marcelaguiar6815 6 років тому

    When is the more in-depth sequel coming out?

    • @prettyprinted
      @prettyprinted  6 років тому

      Hopefully soon. I have to plan out the next videos I'm going to make.

  • @Babaa_
    @Babaa_ 6 років тому

    Page not found (404)
    help, my register isn't working. This what I get.
    Request Method: GET
    Request URL: 127.0.0.1:8000/register
    Using the URLconf defined in MusicStack.urls, Django tried these URL patterns, in this order:
    admin/
    [name='index']
    new/
    popular/
    account/
    accounts/
    The current path, register, didn't match any of these.

  • @dilipmaharjan3463
    @dilipmaharjan3463 7 років тому

    How do I make the user admin or other roles when registering?

    • @prettyprinted
      @prettyprinted  6 років тому

      You'd have to modify the form (or put some code in your view to handle it). I can cover that in a future video.

    • @dilipmaharjan3463
      @dilipmaharjan3463 6 років тому

      Thanks.

  • @mahamata.2584
    @mahamata.2584 5 років тому

    it's pretty cool Mr

  • @Alex-gn7xk
    @Alex-gn7xk 6 років тому

    How can i Change That Registration text helpers ??

  • @manutheitguy
    @manutheitguy 7 років тому

    Hey! what terminal are you using?

  • @mohamedabdiazizhassan5056
    @mohamedabdiazizhassan5056 6 років тому

    login required is not working djongo plz help me to mkae it work

  • @vinayaksinghsendhaw8903
    @vinayaksinghsendhaw8903 3 роки тому

    Please provide code of this video in zip format , actually github do not show download code in zip , that's why it is so confusing to arrange files ,

  • @GamerFardin
    @GamerFardin 6 років тому

    When I press 'login" it redirects me to the same page again, I suppose it is because I am using django 2.1

    • @prettyprinted
      @prettyprinted  6 років тому

      Do you have cookies enabled?

    • @GamerFardin
      @GamerFardin 6 років тому

      Most probably yes and if thats a problem well I managed to solve this problem after a few lucky guesses and I suppose the whole problem would've been solved if I just disabled cookies

    • @abcefg9008
      @abcefg9008 6 років тому

      @@GamerFardin how did you solve it please

    • @abcefg9008
      @abcefg9008 6 років тому

      @@prettyprinted i have the same probleme Sir

    • @GamerFardin
      @GamerFardin 6 років тому

      In the login.html file in line: I change the the action="{% url 'login' %}" into action="{% url 'home' %}" and I created a new path in my urls.py file which was: path('home/', views.index, name="home") and then I went to the views.py folder and defined a new function called index and added the following codes:
      if request.user.is_authenticated:
      return render(request, "myapp/index.html", {'context': request.user})
      elif request.method == "POST":
      username = request.POST.get('username')
      password = request.POST.get('password')
      user = User.objects.create_user(username=username, password=password)
      user.save()
      a = authenticate(username=username, password=password)
      if a is not None:
      login(request, a)
      return render(request, "myapp/index.html", {'context': request.user})
      else:
      return HttpResponse("something went wrong")
      else:
      return redirect("loginerror")
      of course you might need to make some more adjustments to this code to suit your website but I hope this helps!

  • @laluluhur4324
    @laluluhur4324 6 років тому

    what version ur Django ?

    • @prettyprinted
      @prettyprinted  6 років тому

      At the time of making this video, Django 1.0.

    • @code-dredd
      @code-dredd 6 років тому

      @@prettyprinted It's 2.0, not 1.0.

    • @prettyprinted
      @prettyprinted  6 років тому +1

      @@code-dredd lol yeah, you're right. I typed that without looking haha

  • @llamasarus1
    @llamasarus1 6 років тому

    What happened to password hashing?

  • @ArtsemLisouski
    @ArtsemLisouski 6 років тому +1

    Pls help me, i need to add email, name and surname but i do't know how (

  • @SocratAz
    @SocratAz 6 років тому

    For those looking for the source code, here I am copied, thank you to you Pretty Printed
    github.com/alexandrebouttier/django-authenticate

  • @lilredbb2182
    @lilredbb2182 5 років тому

    why is everyone using the buildin auth user model while the model dost not save user's cellphonenumber ...which is not very realistic to todays' App

    • @prettyprinted
      @prettyprinted  5 років тому

      This is just an example, but I'll try to make an example that includes cell numbers.

    • @lilredbb2182
      @lilredbb2182 5 років тому

      @@prettyprinted ah,o didnt expect you'll response, thanks for your work. expecting to the new ones.

  • @sorenchannel42
    @sorenchannel42 6 років тому

    It is quite too fast for me.

    • @prettyprinted
      @prettyprinted  6 років тому

      The great thing about videos is you can rewatch them. :)

  • @hesamramezani4237
    @hesamramezani4237 3 роки тому

    wow

  • @sachitad
    @sachitad 6 років тому

    If you guys are looking for facebook login in django, here is the tutorial: ua-cam.com/video/PtVu04V027c/v-deo.html

  • @skatenerdify
    @skatenerdify 6 років тому +2

    why are you going by so fast? wtf bro

  • @shaikbyte
    @shaikbyte 5 років тому

    may allah bless u brother

  • @prasaddalavi9683
    @prasaddalavi9683 6 років тому

    who are you man!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @shmuel-k
    @shmuel-k 6 років тому

    zhango