An enhanced permission system which support object permission in Django

**AuthorAlisue <[email protected]>Supported python versionsPython 2.7, 3.3, 3.4, 3.5, 3.6Supported django versions**Django 1.8 – 1.11b

An enhanced permission library which enables a logic-based permission system to handle complex permissions in Django.

Documentation

http://django-permission.readthedocs.org/en/latest/

Installation

Use pip like:

$ pip install django-permission

Usage

The following might help you to understand as well.

Configuration

Add permission to the INSTALLED_APPS in your settings module

INSTALLED_APPS = (
    # ...
    'permission',
)

Add our extra authorization/authentication backend

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend', # default
    'permission.backends.PermissionBackend',
)

Follow the instructions below to apply logical permissions to django models

Autodiscovery

Like django’s admin package, django-permission automatically discovers the perms.py in your application directory by running “permission.autodiscover()“. Additionally, if the perms.py module has a PERMISSION_LOGICS variable, django-permission automatically run the following functions to apply the permission logics.

for model, permission_logic_instance in PERMISSION_LOGICS:

 

 

 

To finish reading, please visit source site