django-finegrained-permissions 0.0.1

Add permissions per field instead of per model

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.

GPL

Author

L. van de Kerkhof

Pip

django-finegrained-permissions==0.0.1

Classifiers

  • Environment :: Web Environment
  • Framework :: Django
  • Intended Audience :: Developers
  • Programming Language :: Python
  • Programming Language :: Python :: 2.6
  • Development Status :: 4 - Beta
  • Environment :: Console
  • Topic :: Internet :: WWW/HTTP :: Site Management
  • Operating System :: POSIX
  • Operating System :: MacOS :: MacOS X
  • License :: OSI Approved :: GNU General Public License (GPL)
  • Topic :: Internet :: WWW/HTTP :: Dynamic Content
File Type Python Version Uploaded On Downloads
django-finegrained-permissions-0.0.1.tar.gz Source Aug. 22, 2011 2,773
Version Release Date
0.0.1 Aug. 22, 2011
Date Package Version Action
Aug. 24, 2015, 11:02 p.m. django-finegrained-permissions 0.0.1 Release Created
Aug. 24, 2015, 11:02 p.m. django-finegrained-permissions Package Created