August 2016
Beginner to intermediate
717 pages
15h 24m
English
Now that you can create users, you must create a login page to allow the user to authenticate. We must add the following URL in the urls.py file:
url(r'^connection$', 'TasksManager.views.connection.page', name="public_connection"),
You must then create the connection.py view with the following code:
from django.shortcuts import render from django import forms from django.contrib.auth import authenticate, login # This line allows you to import the necessary functions of the authentication module. def page(request): if request.POST: # This line is used to check if the Form_connection form has been posted. If mailed, the form will be treated, otherwise it will be displayed to the user. form = Form_connection(request.POST) if form.is_valid(): ...
Read now
Unlock full access