mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-23 13:52:17 -06:00
Simplify the aggregation of constraint sets
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user