How about that for starters?
- def login(request):
m = Member.objects.get(username=request.POST['username']) if m.password == request.POST['password']: request.session['member_id'] = m.id return HttpResponse("You're logged in.") else: return HttpResponse("Your username and password didn't match.")The documentation goes from that to explaining how to set cookies. How do they expect me to understand what's going on?There's absolutely NO explanation of what's going on in that code.request.session['member_id'] = m.idHow the hell does that work?They don't tell you where the session is started, how, what the scope of the session declaration is, etc...See that video? The video shows you how to use sessions very quickly. How did the person in the video get ALL of that code from just the documentation?If all readers in this thread and kindly tackle each point I made, I promise you your own KFC when I start my empire. Until then, I really just need someone to give me the step-by-step on this one. I'm completely new to the framework and the documentation thus far has not been helpful. I've mainly gotten by with the help of StackOverflow, IRC, and random code snippets online -- and occasionally, some outdated books.If you don't want to explain or aren't going to ask me progressive questions with regards to my confusion, please just skip over my plight.Thank you all.
I don't understand why you think you need to know these things in order to use sessions. If you want to understand how assigning to a session is implemented, you're free to dive into the code itself. But that's literally *all you need to do* in order to use the session in the view (assuming you've followed the rest of the instructions on that page, eg added the middleware).
--
DR.
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/iyInVbiR_XoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment