Skip to main content

Class based Django permissions for Django models.

Project description

Simple class based permissions.

Installation

  1. Install using pip:

    pip install django-perm

  2. In settings.py:

    # Add to INSTALLED_APPS

    ‘perm’,

    # Add to AUTHENTICATION_BACKENDS

    ‘perm.backends.ModelPermissionBackend’,

Usage

In your Django app, create a file permissions.py. Its content might look like this:

from perm.decorators import permissions_for from perm.permissions import ModelPermissions

from .models import Foo

@permissions_for(Foo) class ProjectPermissions(FooPermissions):

def has_perm_wiggle(self):

# Let’s ask the Foo object return self.obj.user_can_wiggle(self.user)

def get_perm_change_queryset(self):

# Foo objects can be changed by their owners return Foo.objects.filter(user=self.user)

Questions

Do you have a question about django-perm? Please ask it on StackOverflow.com so others can help out and/or learn. Tag your question django-perm if possible.

http://stackoverflow.com/

Bugs and requests

If you have found a bug or a request for additional functionality, please use the issue tracker on GitHub.

https://github.com/dyve/django-perm/issues

About

django-perm is written by Dylan Verheul (dylan@dyve.net).

License

You can use this under Apache 2.0. See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-perm-2.0.0.tar.gz (6.4 kB view details)

Uploaded Source

File details

Details for the file django-perm-2.0.0.tar.gz.

File metadata

  • Download URL: django-perm-2.0.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-perm-2.0.0.tar.gz
Algorithm Hash digest
SHA256 6365ccf6e225b10d8d080406ecddc336dada9be644e2030c07abb46dbd06581c
MD5 b5d7d931e6d37f3835d14213139391e4
BLAKE2b-256 8fcb4720b06c50cf924ebb0ca589023d4a7d97e9f1d72edd7a5915b1a332576b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page