Simple class based permissions.
Installation
Install using pip:
pip install django-perm
In settings.py:
# Add to INSTALLED_APPS 'perm', # Add to AUTHENTICATION_BACKENDS 'perm.backends.ModelPermissionBackend',
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.
Bugs and requests
If you have found a bug or a request for additional functionality, please use the issue tracker on GitHub.
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.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-perm-2.5.0.tar.gz | 8.1 kB | Details |
Release files / django-perm-2.5.0.tar.gz
| Download URL | django-perm-2.5.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28643d12701d1b34c1f73cf98834a8763765e657783cde727ccc06347ddda33c
|
|
BLAKE2b-256 checksum How to use checksums |
a1dc3f9bfff8ca9c03fc73e65a5ece8f31fa6abdf8e14bd06b3555ae1d03e00c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |