Opened 9 years ago
Last modified 9 years ago
#25019 closed Bug
DjangoJSONEncoder does not encode UUIDs — at Version 5
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 (last modified by )
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.
EDIT
Reopened as Bug with version 1.8 in response to conversation with Russell Keith-Magee in django-developers mailing list.
Change History (6)
by , 9 years ago
Attachment: | example.tar.gz added |
---|
comment:1 by , 9 years ago
Easy pickings: | set |
---|
comment:2 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 9 years ago
This also impacts the use of UUID fields in other projects, such as django-allauth,
https://github.com/pennersr/django-allauth/issues/916
I believe this fix should also be back ported to the 1.8.x branch because the expected behaviour of 'I serialise my User Model which has a UUID field' into my session or cache crashes.
Cherry picking this commit into the 1.8.x branch fixed all my problems.
comment:5 by , 9 years ago
Description: | modified (diff) |
---|---|
Resolution: | fixed |
Status: | closed → new |
Type: | New feature → Bug |
Version: | master → 1.8 |
In 6355a6d: