Simplify the aggregation of constraint sets

This commit is contained in:
Jeremy Stretch
2020-08-07 14:09:55 -04:00
parent a05e5657ef
commit 68d89090bf
2 changed files with 12 additions and 9 deletions

View File

@@ -285,3 +285,11 @@ class ObjectPermission(models.Model):
def __str__(self):
return self.name
def list_constraints(self):
"""
Return all constraint sets as a list (even if only a single set is defined).
"""
if type(self.constraints) is not list:
return [self.constraints]
return self.constraints