Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 693 Bytes

permission_required_mixin.md

File metadata and controls

19 lines (13 loc) · 693 Bytes

PermissionRequiredMixin +

This Mixin is mean to inherit any type of View class and expands the base Django PermissionRequiredMixin class. The new functionality is that you can put a dictionary on the permission_required in order to change the permissions between the HTTP method: GET, POST, etc.

Example

from django.views.generic import View

from app.mixins import PermissionRequiredMixin


class SomeView(PermissionRequiredMixin, View):
    permission_required = {
        'GET': 'app.some_permission',
        'POST': 'app.some_other_permission'
    }