I'm trying to reset my user permissions to assign new objects permissions to my user. how to achieve that ?
For Example:
having 3 chained models School
& Grade
& StudentRecord
Models.py:
class School(models.Model):
name = models.CharField(_("Name"),max_length=50)
# other fields ...
def __str__(self):
return self.name
class Grade(models.Model):
code_name = models.CharField(_("Name"),max_length=50)
school = models.ForeignKey(School,on_delete=models.CASCADE,blank=False,related_name='grades')
# other fields ...
def __str__(self):
return self.code_name
class StudentRecord(models.Model):
code_name = models.CharField(_("Name"),max_length=50)
school = models.ForeignKey(School,on_delete=models.CASCADE,blank=False,related_name='grades')
grade = models.ForeignKey(Grade,on_delete=models.CASCADE,blank=False,related_name="student_records")
# other fields ...
def __str__(self):
return self.code_name
When I give a User
as a Manager the perms (add,change,view,delete) for all objects of models which belong to specific school that User
manage. If I need to change the Manager (User
). I need to reset all permissions and reassign for all related objects of this specific school.
How To Acheive This Approach? any support will be appreciated.