Skip to main content

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',
  3. In your main urls.py, at the end add:

    # Load django-perm
    urlpatterns += patterns('', url('^/perm/', include('perm.urls')))

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 FooPermissions(ModelPermissions):

    def has_perm_wiggle(self):
        # Let's ask the Foo object
        return self.obj.user_can_wiggle(self.user)

    def get_queryset_perm_change(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.

Release files for django-perm 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-perm 2.2.1
File Size Uploaded
django-perm-2.2.1.tar.gz 7.6 kB Details

Release files / django-perm-2.2.1.tar.gz

Download URL django-perm-2.2.1.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c38e5b08bc2d77a7e511f6b895e7ba08c215e88757d3e4c7d64d200436a3bf78
BLAKE2b-256 checksum
How to use checksums
23678c0f295bcb9d154290fbcadae3de9817e6580128e4f37c24954220a15ae4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

2.5.0

1 release file

2.4.1

1 release file

2.4.0

1 release file

2.3.0

1 release file

This release

2.2.1 This release

1 release file

2.2.0

1 release file

2.1.0

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.4.0

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.0.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page