Opened 9 years ago
Last modified 9 years ago
#25019 closed Bug
DjangoJSONEncoder does not encode UUIDs — at Initial Version
Reported by: | lukas-hetzenecker | Owned by: | nobody |
---|---|---|---|
Component: | Core (Serialization) | Version: | 1.8 |
Severity: | Normal | Keywords: | UUIDField DjangoJSONEncoder |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Django extends the standard the json encoder from the standard library to enhance its functionality, for example by providing methods to serialize Datetimes and Decimals.
Because UUIDField was included in Django, serialization of uuid.UUID should be possible too.
There are projects out there that make use of UUIDFields and that will run in problems if they try to serialize the model. An example for such a bug report is https://github.com/sehmaschine/django-grappelli/issues/635
Example project is attached.