Django Rest API using Django REST Framework- Permission

Hi there,

Today we are going through on permission of the Django REST Framework. In the Django rest framework, there is 2 types of permission.

  1. Built-in permission
  2. Custom permission.

In this part of the article, we talk about custom permission. Suppose you have a model named song and it has several fields like below.

from django.db import models
class Song(models.Model):
    title = models.CharField(max_length=100)
    parentId = models.CharField(max_length=200)
    spectogram_text = models.TextField()
    harmonic_text = models.TextField()
    texture = models.TextField()
    pathname = models.CharField(max_length=100)

We will create a CRUD system where we impose some permission like below:

  1. All song is displayed logged in user.
  2. Superusers can delete a song.
  3. the owner can update the song
  4. Any logged-in user can add a new song.

About Author


Welcome to I am working in an automation company as a software engineer. From the deep thirst of learning, I have developed this platform.