Skip to content

Commit

Permalink
improve taskexec admin listing performance followup (more robust migr…
Browse files Browse the repository at this point in the history
…ation)
  • Loading branch information
olivierdalang committed Mar 4, 2024
1 parent fb26d1e commit 7704f26
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions django_toosimple_q/migrations/0015_taskexec_result_preview.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Generated by Django 4.1 on 2024-03-04 15:28

from django.db import migrations, models
from django.template.defaultfilters import truncatechars


def populate_result_preview(apps, schema_editor):
# Populate the new result preview field
TaskExec = apps.get_model("toosimpleq", "TaskExec")
for task_exec in TaskExec.objects.all():
task_exec.result_preview = truncatechars(str(task_exec.result), 255)
task_exec.save()
TaskExec.objects.filter(result__isnull=False).update(
result_preview="*preview not generated*"
)


class Migration(migrations.Migration):
Expand Down

0 comments on commit 7704f26

Please sign in to comment.