Source

django-perms / perms / models.py

Full commit
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType


PERMISSIONS = {
    '__all__': ('view', 'change', 'delete'),
    'decision': ('mark_as_finished',)
}



class ObjectPermission(models.Model):
    ACTION_CHOICES= (
        # all objects
        ('can_view', 'Can view'),
        ('can_change', 'Can change'),
        ('can_delete', 'Can delete'),
        
        
    )
    
    user = models.ForeignKey(User)
    action = models.CharField(max_length=32, choices=ACTION_CHOICES)
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()