This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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',
    
  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 History

Release History

This version
History Node

2.5.0

History Node

2.4.1

History Node

2.4.0

History Node

2.3.0

History Node

2.2.1

History Node

2.2.0

History Node

2.1.0

History Node

2.0.1

History Node

2.0.0

History Node

1.4.0

History Node

1.3.2

History Node

1.3.1

History Node

1.3.0

History Node

1.2.0

History Node

1.0.0

History Node

0.3.1

History Node

0.3.0

History Node

0.2.0

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-perm-2.5.0.tar.gz (8.1 kB) Copy SHA256 Checksum SHA256 Source Apr 28, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting