Hi Waldemar! You are right, it would have been better do point Oliver to the generic views, because it's easier, less error-prone and future-proof than writing the views yourself. I don't remember exactly why I wrote the views myself, I think it had something to do with me wanting to use the HTTP_REFERER to redirect users after login, and me didn't knowing about the "redirect_field_name" parameter at that time.
Oliver, better than writing the views yourself use the generic views that come with Django: http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.login Best Regards, Jesaja Everling On Sat, Nov 22, 2008 at 12:23 PM, Waldemar Kornewald <[EMAIL PROTECTED]> wrote: > > Hi Jesaja, > > On Nov 21, 9:44 pm, "Jesaja Everling" <[EMAIL PROTECTED]> wrote: >> class LoginForm(forms.Form): >> username = forms.CharField(label = "Username", max_length=30) >> passwort = forms.CharField(label = "Password", >> widget=forms.widgets.PasswordInput(), max_length=30) >> >> def login(request): >> if request.user.is_authenticated(): >> return HttpResponseRedirect("/") >> errors = "" >> form = LoginForm() >> if request.method == "POST": >> next = request.GET.get("next", "/") >> form = LoginForm(request.POST) >> if form.is_valid(): >> username = form.cleaned_data['username'] >> passwort = form.cleaned_data['passwort'] >> user = auth.authenticate(username = username, password = >> passwort) >> if user is not None and user.is_active: >> auth.login(request, user) >> return HttpResponseRedirect(next) >> else: >> errors = "Can't log you in. Wrong password?" >> return render_to_response("login/user.html", >> RequestContext(request, {'form': form, 'errors': errors})) > > Why did you write your own functions and forms? Don't Django's > auth.forms and auth.views work? > > Bye, > Waldemar Kornewald > > > -- o L_/ OL This is Schäuble. Copy Schäuble into your signature to help him on his way to Überwachungsstaat. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. 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/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
