|
|
|
@ -418,7 +418,23 @@ class AssetGroup(models.Model):
|
|
|
|
|
allowed = models.JSONField(null=True, blank=True, default=dict)
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
return f"{self.name} ({self.restrictions})"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def matches(self):
|
|
|
|
|
"""
|
|
|
|
|
Get the total number of matches for this group.
|
|
|
|
|
"""
|
|
|
|
|
if isinstance(self.allowed, dict):
|
|
|
|
|
truthy_values = [x for x in self.allowed.values() if x is True]
|
|
|
|
|
return f"{len(truthy_values)}/{len(self.allowed)}"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def restrictions(self):
|
|
|
|
|
"""
|
|
|
|
|
Get the total number of restrictions for this group.
|
|
|
|
|
"""
|
|
|
|
|
return self.assetrestriction_set.count()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AssetRestriction(models.Model):
|
|
|
|
|