| 34 | |
| 35 | **How to reproduce:** |
| 36 | |
| 37 | {{{#!python |
| 38 | import uuid |
| 39 | from django.contrib.postgres.fields import ArrayField, JSONField |
| 40 | from django.core.serializers.json import DjangoJSONEncoder |
| 41 | |
| 42 | class Test(models.Model): |
| 43 | uuid = models.UUIDField(unique=True, default=uuid.uuid4, editable=False) |
| 44 | data = ArrayField( |
| 45 | JSONField(encoder=DjangoJSONEncoder), |
| 46 | max_length=200, |
| 47 | blank=True, |
| 48 | default=list, |
| 49 | ) |
| 50 | }}} |
| 51 | |
| 52 | **Now to test do the following:** |
| 53 | |
| 54 | {{{#!python |
| 55 | from decimal import Decimal |
| 56 | from django.core import serializers |
| 57 | from test.models import Test |
| 58 | |
| 59 | test = Test(data=[{'threshold_amount_usd': Decimal('0'), 'taint_percent_threshold': Decimal('0')}]) |
| 60 | serializers.serialize("json", (test,)) |
| 61 | |
| 62 | test = Test(data=[{'id': uuid4()}]) |
| 63 | serializers.serialize("json", (test,)) |
| 64 | }}} |