def add_row_perm(self, instance, perm):
     if self.has_row_perm(instance, perm):
         return False
     permission = Permission()
     permission.content_object = instance
     permission.group = self
     permission.name = perm
     permission.save()
     return True
Exemple #2
0
    def add_row_perm(self, instance, perm):

        if type(instance).__name__ == 'QuerySet':
            for object in instance:
                if self.has_row_perm(object, perm):
                    pass
                permission = Permission()
                permission.content_object = object
                permission.user = self
                permission.name = perm
                permission.save()
        else:
            if self.has_row_perm(instance, perm):
                return False
            permission = Permission()
            permission.content_object = instance
            permission.group = self
            permission.name = perm
            permission.save()
        return True
Exemple #3
0
    def add_row_perm(self, instance, perm):

        if type(instance).__name__ == 'QuerySet':
            for object in instance:
                if self.has_row_perm(object, perm):
                    pass
                permission = Permission()
                permission.content_object = object
                permission.user = self
                permission.name = perm
                permission.save()
        else:
            if self.has_row_perm(instance, perm):
                return False
            permission = Permission()
            permission.content_object = instance
            permission.group = self
            permission.name = perm
            permission.save()
        return True