-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve taskexec admin listing performance
- Loading branch information
1 parent
9be62ee
commit f324019
Showing
4 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
django_toosimple_q/migrations/0015_taskexec_result_preview.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("toosimpleq", "0014_alter_workerstatus_exit_code"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="taskexec", | ||
name="result_preview", | ||
field=models.CharField( | ||
blank=True, editable=False, max_length=255, null=True | ||
), | ||
), | ||
migrations.RunPython(populate_result_preview), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters