Changes between Initial Version and Version 3 of Ticket #33086


Ignore:
Timestamp:
Sep 7, 2021, 1:39:33 AM (3 years ago)
Author:
Anudeep Samaiya
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33086

    • Property Cc Anudeep Samaiya added
    • Property Owner changed from < anudeepsamaiya > to Anudeep Samaiya
    • Property Status assignednew
    • Property Summary Postgres Contrib ArrayField raises error on serialization with "django.core.serializers.json"ArrayField with UUIDField raises error on serialization with "django.core.serializers.json"
    • Property Patch needs improvement set
    • Property Needs documentation set
    • Property Needs tests set
  • Ticket #33086 – Description

    initial v3  
    3232    return json.dumps(values, cls=encoder)
    3333}}}
     34
     35**How to reproduce:**
     36
     37{{{#!python
     38import uuid
     39from django.contrib.postgres.fields import ArrayField, JSONField
     40from django.core.serializers.json import DjangoJSONEncoder
     41
     42class 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
     55from decimal import Decimal
     56from django.core import serializers
     57from test.models import Test
     58
     59test = Test(data=[{'threshold_amount_usd': Decimal('0'), 'taint_percent_threshold': Decimal('0')}])
     60serializers.serialize("json", (test,))
     61
     62test = Test(data=[{'id': uuid4()}])
     63serializers.serialize("json", (test,))
     64}}}
Back to Top