fix: delete perm on user/group/team deletion

This is done manually using signal because we do not use a foreign key
so we do not have automatically cascade deletion.
This commit is contained in:
Élie Bouttier 2014-08-30 16:27:13 -07:00
parent b4be56bb47
commit b9b892417b
4 changed files with 66 additions and 1 deletions

View file

@ -1,6 +1,7 @@
from django.db import models
from django.db.models import Q
from django.utils.encoding import python_2_unicode_compatible
from django import VERSION
from tracker.models import Project
from accounts.models import *
@ -68,7 +69,6 @@ class PermissionModel(models.Model):
@property
def type(self):
return self.get_grantee_type_display()
# return dict(self.GRANTEE_TYPE)[self.grantee_type]
@property
def name(self):
@ -142,3 +142,7 @@ class ProjectPermission(PermissionModel):
def __str__(self):
return self.grantee.__str__() + "'s permissions on " \
+ self.project.name + " project"
if VERSION < (1, 7):
import tracker.signals