Fixes #19204: Use DjangoJSONEncoder for Job data (#19297)

This commit is contained in:
Jeremy Stretch 2025-04-23 16:57:48 -04:00 committed by GitHub
parent 0ce307c7fd
commit fbf926204e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,17 @@
import django.core.serializers.json
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0012_job_object_type_optional'),
]
operations = [
migrations.AlterField(
model_name='job',
name='data',
field=models.JSONField(blank=True, encoder=django.core.serializers.json.DjangoJSONEncoder, null=True),
),
]

View File

@ -5,6 +5,7 @@ import django_rq
from django.conf import settings from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.fields import GenericForeignKey
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.serializers.json import DjangoJSONEncoder
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
from django.db import models, transaction from django.db import models, transaction
from django.urls import reverse from django.urls import reverse
@ -90,8 +91,9 @@ class Job(models.Model):
) )
data = models.JSONField( data = models.JSONField(
verbose_name=_('data'), verbose_name=_('data'),
encoder=DjangoJSONEncoder,
null=True, null=True,
blank=True blank=True,
) )
error = models.TextField( error = models.TextField(
verbose_name=_('error'), verbose_name=_('error'),