May 2018
Beginner to intermediate
526 pages
11h 57m
English
We are going to restrict access to the views so that only users with the appropriate permissions can add, change, or delete Course objects. We are going to use the following two mixins provided by django.contrib.auth to limit access to views:
Edit the views.py file of the courses application and add the following import:
from django.contrib.auth.mixins import LoginRequiredMixin, \ PermissionRequiredMixin
Make OwnerCourseMixin inherit LoginRequiredMixin like this:
class OwnerCourseMixin(OwnerMixin, ...
Read now
Unlock full access