1. Waldemar Kornewald
  2. djangotoolbox

Commits

d3f3nd3r  committed 241a060

add PermissionList, Group is linked to PermissionList

  • Participants
  • Parent commits 28c5a70
  • Branches default

Comments (0)

Files changed (1)

File djangotoolbox/contrib/auth/models.py

View file
         verbose_name = _('permission')
         verbose_name_plural = _('permissions')
         unique_together = (('content_type', 'codename'),)
-        ordering = ('content_type__app_label', 'content_type__model', 'codename')
+        #ordering = ('content_type__app_label', 'content_type__model', 'codename')
 
     def __unicode__(self):
         return u"%s | %s | %s" % (
         return (self.codename,) + self.content_type.natural_key()
     natural_key.dependencies = ['contenttypes.contenttype']
 
+
+class PermissionList(models.Model):
+    permissions = ListField(models.ForeignKey(Permission))
+
+    
 class Group(models.Model):
     """Groups are a generic way of categorizing users to apply permissions, or some other label, to those users. A user can belong to any number of groups.
 
     """
     name = models.CharField(_('name'), max_length=80, unique=True)
 
-    # turn permission system off
-    #permissions = models.ManyToManyField(Permission, verbose_name=_('permissions'), blank=True)
+    permissions = models.ForeignKey(PermissionList, verbose_name=_('permissions'), blank=True, null=True)
 
     class Meta:
         verbose_name = _('group')