pep8
This commit is contained in:
parent
0ecf6d3dc9
commit
92ea48f89d
12 changed files with 55 additions and 47 deletions
|
@ -7,7 +7,7 @@ from permissions.models import PermissionModel
|
|||
from accounts.models import *
|
||||
|
||||
|
||||
__all__ = [ 'GlobalPermissionForm', 'ProjectPermissionForm' ]
|
||||
__all__ = ['GlobalPermissionForm', 'ProjectPermissionForm']
|
||||
|
||||
|
||||
class PermissionForm(forms.ModelForm):
|
||||
|
@ -52,9 +52,9 @@ class GlobalPermissionForm(PermissionForm):
|
|||
|
||||
class Meta:
|
||||
model = GlobalPermission
|
||||
fields = [ 'grantee_type', 'grantee_id' ]
|
||||
fields = ['grantee_type', 'grantee_id']
|
||||
widgets = {
|
||||
'grantee_id': HiddenInput,
|
||||
'grantee_id': HiddenInput,
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ class ProjectPermissionForm(PermissionForm):
|
|||
class Meta:
|
||||
model = ProjectPermission
|
||||
# project is required for the unicity check
|
||||
fields = [ 'project', 'grantee_type', 'grantee_id' ]
|
||||
fields = ['project', 'grantee_type', 'grantee_id']
|
||||
widgets = {
|
||||
'project': HiddenInput,
|
||||
'grantee_id': HiddenInput,
|
||||
|
|
|
@ -7,7 +7,7 @@ from tracker.models import Project
|
|||
from accounts.models import *
|
||||
|
||||
|
||||
__all__ = [ 'GlobalPermission', 'ProjectPermission' ]
|
||||
__all__ = ['GlobalPermission', 'ProjectPermission']
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
@ -82,7 +82,7 @@ class PermissionModel(models.Model):
|
|||
class GlobalPermission(PermissionModel):
|
||||
|
||||
class Meta:
|
||||
unique_together = ( 'grantee_type', 'grantee_id' )
|
||||
unique_together = ('grantee_type', 'grantee_id')
|
||||
|
||||
# Global permissions
|
||||
|
||||
|
@ -120,7 +120,7 @@ class GlobalPermission(PermissionModel):
|
|||
class ProjectPermission(PermissionModel):
|
||||
|
||||
class Meta:
|
||||
unique_together = ( 'project', 'grantee_type', 'grantee_id' )
|
||||
unique_together = ('project', 'grantee_type', 'grantee_id')
|
||||
|
||||
project = models.ForeignKey(Project, related_name='permissions')
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ on the foreign object id, we can rely on database cascade deletion to delete
|
|||
outaded permissions and we have to do it our-self.
|
||||
"""
|
||||
|
||||
|
||||
@receiver(pre_delete, sender=User, dispatch_uid="clean_user_perms")
|
||||
def clean_user_perms(sender, instance, **kwargs):
|
||||
# Clean global permissions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue