Hi Sabine, Your code looks good. Can you post you template code?
Why are you not using form `is_valid`? [0] What version of Django are you using? You can be facing that your request.POST is empty! [1] This may be not what you are looking for but you can use Django Authentication System [2] Best 0 - https://docs.djangoproject.com/en/1.6/ref/forms/api/#using-forms-to-validate-data 1 - https://docs.djangoproject.com/en/1.6/ref/request-response/#django.http.HttpRequest.POST 2 - https://docs.djangoproject.com/en/1.4/topics/auth/#django.contrib.auth.views.login On Fri, Sep 26, 2014 at 6:32 PM, Sabine Maennel <[email protected]> wrote: > This is my login view: > > def login_view(request,template_name='userauth/login.html'): > > if request.method == 'POST': > username = request.POST.get('username') > password = request.POST.get('password') > print username > print password > user = authenticate(username=username, password=password) > if user is not None: > if user.is_active: > login(request, user) > next_page = reverse('public:courselist') > else: > next_page = reverse('userauth:login') > messages.error(request, "Ihr Account wurde deaktiviert. > Bitte nehmen Sie Kontakt zu uns auf, wenn Sie Ihnen wieder aktivieren > wollen.") > else: > next_page = reverse('userauth:login') > messages.error(request, u'Ung\u00FCltiges Login') > else: > dictionary = {'form': form } > return render_to_response('userauth/login.html', dictionary, > context_instance=RequestContext(request)) > > return HttpResponseRedirect(next_page) > > > And this is my form: > from django import forms > > class LoginForm(forms.Form): > > username = forms.CharField( > max_length=100, > widget=forms.TextInput, > required=False, > label="", > ) > password = forms.CharField( > max_length=100, > widget=forms.TextInput, > required=False, > label="", > ) > > I think I need to tell Django somehow about the form, but I do need really > know where? Can someone please help me with figuring this out? When I print > out the username and password they are both None. > > Thanks in advance > Sabine > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/db52e99e-0ce1-469c-91f7-80fdad3272eb%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Alejandro Varas G. http://alejandrovaras.me -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL60njLEwtgsSGco%2B%3DMWDV-AAnyvdSrUp_sWkgKXRB6X6A3Qjw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

