Skip to main content
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!

Taking (delegating) REST permissions from a model instance to a model pointed by ForeignKey/m2m

Project Description

Delegate django rest framework object permissions to an object pointed by foreign key/m2m

Sample: set up permissions so that anyone having django/django guardian permissions on Invoice will have the same set of permissions on its address:

class Address(models.Model):
    ... address fields

class Invoice(models.Model):
    address = models.OneToOneField(Address, related_name='invoice')
    ... invoice fields

perms = RestPermissions()

@perms.apply(permissions=DelegatedPermissions(perms, "invoice")
class AddressViewSet(ModelViewSet):
    queryset = Address.objects.all()
    serializer = AddressSerializer
    ...

@perms.apply()            # implicitely adds django model permissions and guardian permissions
class InvoiceViewSet(ModelViewSet):
    queryset = Invoice.objects.all()
    serializer = InvoiceSerializer
    ...

See docs and API at github.

Release History

This version
History Node

0.5.6.1

History Node

0.5.6

History Node

0.5.5.2

History Node

0.5.5.1

History Node

0.5.5

History Node

0.5.4

Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
django-rest-delegated-permissions-0.5.6.1.tar.gz
(5.9 kB) Copy SHA256 Hash SHA256
Source None Jan 22, 2018

Supported By

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 Google Google Cloud Servers DreamHost DreamHost Log Hosting