policies: fix incorrect bound_to count
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
d9172cb296
commit
b4d528a789
|
@ -48,9 +48,7 @@ class PolicySerializer(ModelSerializer, MetaNameSerializer):
|
||||||
|
|
||||||
def get_bound_to(self, obj: Policy) -> int:
|
def get_bound_to(self, obj: Policy) -> int:
|
||||||
"""Return objects policy is bound to"""
|
"""Return objects policy is bound to"""
|
||||||
if not obj.bindings.exists() and not obj.promptstage_set.exists():
|
return obj.bindings.count() + obj.promptstage_set.count()
|
||||||
return 0
|
|
||||||
return obj.bindings.count()
|
|
||||||
|
|
||||||
def to_representation(self, instance: Policy):
|
def to_representation(self, instance: Policy):
|
||||||
# pyright: reportGeneralTypeIssues=false
|
# pyright: reportGeneralTypeIssues=false
|
||||||
|
|
Reference in New Issue