Source

django-extauth / extauth / models.py

Full commit
'''
Copyright 2009 H. Lee Moffitt Cancer Center and Research Institute, Inc. 
All rights reserved.

@author: Michael Hall <mhall119@gmail.com>
'''
from django.contrib import auth
from django.db import models
from django.contrib.contenttypes.models import ContentType

class Role(models.Model):
    
    class Meta:
        verbose_name = "Role"
        unique_together = (('model', 'role'),)
        
    model = models.ForeignKey(ContentType, verbose_name='Model Type')
    role = models.CharField(max_length=255, verbose_name='Role Name')
    permissions = models.ManyToManyField(auth.models.Permission, blank=True, verbose_name='Role Permissions')
    
    def __unicode__(self):
        return "%s.%s: %s" % (self.model.app_label, self.model, self.role)