policies/api: fix target returning pbm_uuid instead of proper primary key of the object

This commit is contained in:
Jens Langhammer
2020-09-08 17:38:41 +02:00
parent f0b5e8143e
commit 9712be847c
11 changed files with 134 additions and 36 deletions

View File

@ -47,6 +47,7 @@ class FlowExporter:
pbm_uuids += FlowStageBinding.objects.filter(target=self.flow).values_list(
"pbm_uuid", flat=True
)
# Add policy objects first, so they are created first
policies = Policy.objects.filter(bindings__in=pbm_uuids).select_related()
for policy in policies:
yield FlowBundleEntry.from_model(policy)