Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

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)

class HarddiskAdmin(admin.ModelAdmin)
    model = Harddisk, HarddiskAdmin)

or:, fgp.enforce(Harddisk, admin.ModelAdmin))

Note that you need to set model even when the admin class is not an inline admin.

Release History

This version
History Node


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
(14.2 kB) Copy SHA256 Hash SHA256
Source None Aug 22, 2011

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