From the course: Securing Django Applications

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Creating a group permissions model

Creating a group permissions model - Django Tutorial

From the course: Securing Django Applications

Start my 1-month free trial

Creating a group permissions model

- Using django Guardian, you can split read write modification, delete permissions into different roles groups. To make sure groups were correctly, you have to create them in a data migration, we're going to be creating two groups. First we need to get the model from the auth app. And then we need to actually create the group. And the first one is for account manager. And the second one is the customer's support group. This will be run as part of the data migration here. And then to actually assign the permissions we need to go into apps. And we need to use the post migrate signal. And whenever the data migration is run, we're going to be making sure that we set up the group permissions. So the groups are created, and then we're going to be assigning the permissions using a small utility function, which is based on django guardians assign perm function. And for the accounts manager, they will have permission to change a…

Contents