flows/transfer: fix missing unique fields for PolicyBinding
This commit is contained in:
parent
bb9ae28be8
commit
28893b9695
|
@ -52,7 +52,7 @@ class FlowExporter:
|
||||||
yield FlowBundleEntry.from_model(policy)
|
yield FlowBundleEntry.from_model(policy)
|
||||||
bindings = PolicyBinding.objects.filter(target__in=pbm_uuids).select_related()
|
bindings = PolicyBinding.objects.filter(target__in=pbm_uuids).select_related()
|
||||||
for binding in bindings:
|
for binding in bindings:
|
||||||
yield FlowBundleEntry.from_model(binding)
|
yield FlowBundleEntry.from_model(binding, "policy", "target", "order")
|
||||||
|
|
||||||
def walk_stage_prompts(self) -> Iterator[FlowBundleEntry]:
|
def walk_stage_prompts(self) -> Iterator[FlowBundleEntry]:
|
||||||
"""Walk over all prompts associated with any PromptStages"""
|
"""Walk over all prompts associated with any PromptStages"""
|
||||||
|
|
|
@ -12,7 +12,7 @@ class PolicyBindingSerializer(ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
model = PolicyBinding
|
model = PolicyBinding
|
||||||
fields = ["policy", "target", "enabled", "order", "timeout"]
|
fields = ["pk", "policy", "target", "enabled", "order", "timeout"]
|
||||||
|
|
||||||
|
|
||||||
class PolicyBindingViewSet(ModelViewSet):
|
class PolicyBindingViewSet(ModelViewSet):
|
||||||
|
|
|
@ -44,7 +44,7 @@ class PolicyBinding(SerializerModel):
|
||||||
enabled = models.BooleanField(default=True)
|
enabled = models.BooleanField(default=True)
|
||||||
|
|
||||||
policy = InheritanceForeignKey("Policy", on_delete=models.CASCADE, related_name="+")
|
policy = InheritanceForeignKey("Policy", on_delete=models.CASCADE, related_name="+")
|
||||||
target = models.ForeignKey(
|
target = InheritanceForeignKey(
|
||||||
PolicyBindingModel, on_delete=models.CASCADE, related_name="+"
|
PolicyBindingModel, on_delete=models.CASCADE, related_name="+"
|
||||||
)
|
)
|
||||||
negate = models.BooleanField(
|
negate = models.BooleanField(
|
||||||
|
|
|
@ -6243,6 +6243,11 @@ definitions:
|
||||||
- order
|
- order
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
pk:
|
||||||
|
title: Policy binding uuid
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
readOnly: true
|
||||||
policy:
|
policy:
|
||||||
title: Policy
|
title: Policy
|
||||||
type: string
|
type: string
|
||||||
|
|
Reference in New Issue