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. 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.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
urlpatterns = [
path('accounts/login/', auth_views.LoginView.as_view(),
name='login&apos...