bhch / django-jsonform

A better, user-friendly JSON editing form field for Django admin. Also supports Postgres ArrayField.
https://django-jsonform.rtfd.io
BSD 3-Clause "New" or "Revised" License
307 stars 31 forks source link

Object of type UUID is not JSON serializable #137

Closed andres-holvi closed 5 months ago

andres-holvi commented 5 months ago

The admin views appears not to be compatible with nested ArrayFields of type UUIDField.

e.g.:

model definition:

field = ArrayField(
        ArrayField(
            base_field=models.UUIDField(
                null=True,
            ),
            null=True,
            blank=True,
        ),
        null=True,
        blank=True,
    )

field value: [UUID(<uuid1>), UUID(<uuid2>)], [UUID(<uuid1>), None]

Going to the object detail then raises the TypeError: Object of type UUID is not JSON serializable.

Is this a known issue?

Let me know if I misconfigured something. The library was working perfectly otherwise :)

bhch commented 5 months ago

Fixed in #138.