Let's separate the problem into:

a. Form display,
b. Form validation. and
c. Page flow or ordering.

Form display is trivial for this example, since you only need username
and password. This is easily hand-coded into your base template and
you don't need to pass anything to the various views. One nice thing
to do is test user.is_anonymous in the template and, if true, display
the form, else show a link to the user's profile page (or something
like that).

Validation (the specifics of which are covered at
http://www.djangoproject.com/documentation/authentication/) can either
occur via AJAXian methods (I particularly like jQuery + its taconite
plugin for this) or via a normal view that performs the
authentication, showing an error page on failure and for success
simply bouncing the user back using
HttpResponseRedirect(request.META..get('HTTP_REFERER')). They are now
on they page where they initiated the login in, but user.is_anonymous
is now false.

On the site I just finished the whole page (displayed data, link
destinations, etc.) was predicated on whether you were logged in or
not. AJAX would have been too complicated (because so many things
changed) so we used the bounce method and recomputed the whole
shebang. We also had to do our own backend because even if the user is
not in auth_user, there are two additional ways they might validate
(don't blame me, I'm just the contractor who had to make it work).

BTW, if you prefer using email addresses for login (I certainly do),
then see http://www.djangosnippets.org/snippets/74/ for one way to do
this.

  HTH,
  Peter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to