Home > Enterprise >  Django design login
Django design login

Time:08-12

I want to design the login system when I try entering the web and press login button but nothing happens please help me

this is my code enter image description here

enter image description here

enter image description here enter image description here

CodePudding user response:

your variable 'massage' has not been passed into the template as you render the template as a respone. variable ={'mytext' : text } return render(request,'login.html', variable)

and than you can access them in your login html page using jinja templating language. for example variables can be accessed as:

<h1> hello {{mytext}} </h1>

CodePudding user response:

Firstly keep the indentation in a proper way, and format the code.


And secondly, there's no need to put the request keyword while authenticating the user by calling the authenticate method. You can only pass the username and password as like in the documentation.

from django.contrib.auth import authenticate
user = authenticate(username='john', password='secret')
if user is not None:
    # A backend authenticated the credentials
else:
    # No backend authenticated the credentials
  • Related