On Thursday, 2 August 2012 15:31:54 UTC+1, Gregory Thompson Jr. wrote:
>
>
> 1. def login(request):
> 2. m = Member.objects.get(username=request.POST['username'])
> 3. if m.password == request.POST['password']:
> 4. request.session['member_id'] = m.id
> 5. return HttpResponse("You're logged in.")
> 6. else:
> 7. return HttpResponse("Your username and password didn't
> match.")
>
> How about that for starters?
>
> 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.id
>
> How 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...
>
>
> http://www.youtube.com/watch?v=YFd9NLZFmvo&playnext=1&list=PL6CB0A9FA1D9C736A&feature=results_video
>
>
>
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.