Add permissions per field instead of per model
Project description
Add permissions per field instead of per model:
from django.db import models from django.contrib import admin import fgp @fgp.guard('slave', 'master', name='can_edit_master_slave') class Harddisk(models.Model): type = models.CharField(max_length=255) slave = models.BooleanField(default=False) master = models.BooleanField(default=True) @fgp.enforce class HarddiskAdmin(admin.ModelAdmin) model = Harddisk admin.site.register(Harddisk, HarddiskAdmin)
or:
admin.site.register(Harddisk, fgp.enforce(Harddisk, admin.ModelAdmin))
Note that you need to set model even when the admin class is not an inline admin.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-finegrained-permissions-0.0.1.tar.gz
.
File metadata
- Download URL: django-finegrained-permissions-0.0.1.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce92f5a7d0dcc623a5dce341f6b44d5a584608ec99c9f525c71d3acc7be2b58e |
|
MD5 | aa12536220e620ae33c3cae0b412459b |
|
BLAKE2b-256 | c050da2065a06c02b066ec2478de95ca5c1be2ce1d32f24f7106fc7c8d2ec0b7 |