Skip to content

Commit bcb9417

Browse files
committed
Update backfill command to perform action associated with through models
1 parent b6d944f commit bcb9417

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

api/api/management/commands/backfillmoderationdecision.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ def handle(self, *args, **options):
9292
for report, decision in zip(reports_chunk, decisions):
9393
report.decision = decision
9494
MediaReport.objects.bulk_update(reports_chunk, ["decision"])
95-
MediaDecisionThrough.objects.bulk_create(
95+
throughs = MediaDecisionThrough.objects.bulk_create(
9696
[
9797
MediaDecisionThrough(media_obj=report.media_obj, decision=decision)
9898
for report, decision in zip(reports_chunk, decisions)
9999
]
100100
)
101+
# Bulk create does not call ``save()`` so the mark-sensitive/deindex
102+
# actions will not be undertaken.
103+
for through in throughs:
104+
through.perform_action()
101105
t.update(1)
102106

103107
t.info(

0 commit comments

Comments
 (0)