L
L
Larisa .•º2017-10-11 00:04:21
Django
Larisa .•º, 2017-10-11 00:04:21

How to serialize the access rights available to the user?

The application has two types of User models:
- student
- profesor

class Student(model.Models) :
   name  
   age
  is_professor  :  boolean

Access to the fields of the "Lesson" model is different, to implement this task, I write custom Permissions.
Tell me how you can implement the resource, for example, if you request /students/1/, the following was issued.
{
   "name" :  "Ivan",
   "age" : 20,
   "is_professor" :  false,
   "permission" :{
       "can_is_read_lection" : true,
        "can_delete_letion" : false,
  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question