Django Authentication Basics

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ต.ค. 2024

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

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

  • @mzgz4216
    @mzgz4216 6 ปีที่แล้ว +2

    cant wait to see you upcoming videos

  • @MrEdersonlima
    @MrEdersonlima 6 ปีที่แล้ว +1

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

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว +1

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

  • @robinkovacic7961
    @robinkovacic7961 4 ปีที่แล้ว

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

  • @fmkikomina
    @fmkikomina 4 ปีที่แล้ว

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

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

    Really amazing explanation!
    Thanks.

  • @TomislavMiletic
    @TomislavMiletic 4 ปีที่แล้ว

    Do you have a video with more details on authentication?

  • @alialkhulaifi2423
    @alialkhulaifi2423 2 ปีที่แล้ว

    Awesome Explanation! Thanks alot :)

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

      Thanks! I'll definitely make that video soon.

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

  • @jackli2530
    @jackli2530 4 ปีที่แล้ว +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 ?

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

    Great video!

  • @letoan285
    @letoan285 6 ปีที่แล้ว +1

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

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

      That's a good idea for a video. I'll see what I can 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?

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

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

  • @bhushanpathrikar6045
    @bhushanpathrikar6045 4 ปีที่แล้ว

    Damn great plz keep making video on entire django

  • @SimonYells
    @SimonYells 4 ปีที่แล้ว +1

    A perfect tutorial. Thanks !

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

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

  • @tripathi5174
    @tripathi5174 4 ปีที่แล้ว

    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

  • @victorfariaaa
    @victorfariaaa 4 ปีที่แล้ว

    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.

  • @michaelkennedy5126
    @michaelkennedy5126 5 ปีที่แล้ว +1

    thanks for making this tutorial, very useful

    • @prettyprinted
      @prettyprinted  5 ปีที่แล้ว +1

      You're welcome! Thanks for watching.

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

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

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

  • @faraazali9589
    @faraazali9589 4 ปีที่แล้ว

    how do you authenticate with active directory user credentials?

  • @OthmaneLh001
    @OthmaneLh001 6 ปีที่แล้ว

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

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว +1

      Glad you understood it. Thanks for watching.

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

  • @NikitaDharmadhikariNikki
    @NikitaDharmadhikariNikki 4 ปีที่แล้ว

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

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

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

  • @antina314
    @antina314 5 ปีที่แล้ว +1

    Great job! :) Nice introduction to django auth.

  • @sisyphus_619
    @sisyphus_619 6 ปีที่แล้ว

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

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

  • @LexPodgorny
    @LexPodgorny 4 ปีที่แล้ว

    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?

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

    totally worth it !!!

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

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

  • @dude-ox2em
    @dude-ox2em 4 ปีที่แล้ว

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

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

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

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

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

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

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

  • @АнатолийЮров-ж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.

  • @mateuscastanho7202
    @mateuscastanho7202 4 ปีที่แล้ว

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

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

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

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

  • @varunsharma2200
    @varunsharma2200 5 ปีที่แล้ว

    Its really helpful. Thanks

    • @prettyprinted
      @prettyprinted  5 ปีที่แล้ว

      Glad I could help. Thanks for watching!

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

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

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

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 6 ปีที่แล้ว +1

    thanks for this tutorial sir :) keep it up

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

  • @sidyka6568
    @sidyka6568 6 ปีที่แล้ว

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

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

      You're welcome! Thanks for watching.

  • @sunilrajput5149
    @sunilrajput5149 4 ปีที่แล้ว

    it's really helpful, thanks :)

  • @satisharvapalli3457
    @satisharvapalli3457 6 ปีที่แล้ว +1

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

  • @raoufm2428
    @raoufm2428 6 ปีที่แล้ว

    Thank you so much you saved my life

  • @OHOTOLEable
    @OHOTOLEable 6 ปีที่แล้ว

    Could you make a video about signals?

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว +1

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

  • @muralidhar40
    @muralidhar40 2 ปีที่แล้ว

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

  • @rebekawa
    @rebekawa 5 ปีที่แล้ว

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

    • @prettyprinted
      @prettyprinted  5 ปีที่แล้ว

      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

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

    Bro without creating login page path how it was run😢

  • @Alex-gn7xk
    @Alex-gn7xk 6 ปีที่แล้ว

    How can i Change That Registration text helpers ??

  • @Raj_Patel21
    @Raj_Patel21 5 ปีที่แล้ว

    Thanks for the video :)

    • @prettyprinted
      @prettyprinted  5 ปีที่แล้ว

      You're welcome! Thanks for watching.

  • @manutheitguy
    @manutheitguy 6 ปีที่แล้ว

    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 ,

  • @dilipmaharjan3463
    @dilipmaharjan3463 6 ปีที่แล้ว

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

    it's pretty cool Mr

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

  • @GamerFardin
    @GamerFardin 5 ปีที่แล้ว

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

      Do you have cookies enabled?

    • @GamerFardin
      @GamerFardin 5 ปีที่แล้ว

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

      @@GamerFardin how did you solve it please

    • @abcefg9008
      @abcefg9008 5 ปีที่แล้ว

      @@prettyprinted i have the same probleme Sir

    • @GamerFardin
      @GamerFardin 5 ปีที่แล้ว

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

    what version ur Django ?

    • @prettyprinted
      @prettyprinted  5 ปีที่แล้ว

      At the time of making this video, Django 1.0.

    • @code-dredd
      @code-dredd 5 ปีที่แล้ว

      @@prettyprinted It's 2.0, not 1.0.

    • @prettyprinted
      @prettyprinted  5 ปีที่แล้ว +1

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

  • @llamasarus1
    @llamasarus1 6 ปีที่แล้ว

    What happened to password hashing?

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

      It's done by the UserCreationForm.

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

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

  • @ArtsemLisouski
    @ArtsemLisouski 6 ปีที่แล้ว +1

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

  • @sorenchannel42
    @sorenchannel42 6 ปีที่แล้ว

    It is quite too fast for me.

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

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

  • @skatenerdify
    @skatenerdify 5 ปีที่แล้ว +2

    why are you going by so fast? wtf bro

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

    wow

  • @sachitad
    @sachitad 5 ปีที่แล้ว

    If you guys are looking for facebook login in django, here is the tutorial: th-cam.com/video/PtVu04V027c/w-d-xo.html

  • @prasaddalavi9683
    @prasaddalavi9683 6 ปีที่แล้ว

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

  • @shmuel-k
    @shmuel-k 6 ปีที่แล้ว

    zhango

  • @shaikbyte
    @shaikbyte 5 ปีที่แล้ว

    may allah bless u brother