December 2018
Beginner to intermediate
796 pages
19h 54m
English
We will configure permission policies for the class-based views that work with the Drone model. We will override the value for the permission_classes class attribute for the DroneDetail and DroneList classes.
We will add the same lines of code in the two classes. We will include the IsAuthenticatedOrReadOnly class and our recently declared IsCurrentUserOwnerOrReadOnly permission class in the permission_classes tuple.
Open the restful01/drones/views.py file and add the following lines after the last line that declares the imports, before the declaration of the DroneCategorySerializer class:
from rest_framework import permissions from drones import custompermission
Replace the code that declares the DroneDetail ...
Read now
Unlock full access