Adding authentication views
Now that you have created a polymorphic data model, you are going to build a CMS to manage the courses and their contents. The first step is to add an authentication system for the CMS.
Adding an authentication system
You are going to use Django’s authentication framework for users to authenticate to the e-learning platform. You learned how to use the Django authentication views in Chapter 4, Building a Social Website.
Both instructors and students will be instances of Django’s User
model, so they will be able to log in to the site using the authentication views of django.contrib.auth
.
Edit the main urls.py
file of the educa
project and include the login
and logout
views of Django’s authentication framework:
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path
urlpatterns = [
...