in src/wagtail_localize_smartling/management/commands/populate_smartling_job_hashes.py [0:0]
def handle(self, *args, **kwargs) -> None:
jobs = []
for job in Job.objects.filter(content_hash="").select_related(
"translation_source"
):
job.content_hash = compute_content_hash(job.translation_source.export_po())
jobs.append(job)
if jobs:
Job.objects.bulk_update(jobs, ["content_hash"])
self.stdout.write(
self.style.SUCCESS(
f"Successfully populated {len(jobs)} Smartling job content hashes"
)
)
else:
self.stdout.write(
self.style.WARNING(
"Found no Smartling jobs to populate the content_hash field for."
)
)