#24161 closed Bug (fixed)
Using UUIDField for id of custom User model prevents logging in
Description ¶
When using the new UUIDField
in Django 1.8 for the id
of a custom User model, a session fails to be created and a TypeError
exception is thrown when attempting to log in.
TypeError at /login/ UUID('314cb5d6-593f-48f5-b1af-fadedde123d3') is not JSON serializable
Please see the README.md
file of the attached example project.
Change History (9)
by , 10 years ago
Attachment: | 619295fe.zip added |
---|
follow-up: 3 comment:1 by , 10 years ago
Thanks for the example project. Could you also provide the full traceback please.
comment:2 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
I guess we should use user.serializable_value(user._meta.pk.attname)
here.
comment:3 by , 10 years ago
Replying to charettes:
Thanks for the example project. Could you also provide the full traceback please.
comment:4 by , 10 years ago
Has patch: | set |
---|
Create a PR but I'm not sure get_prep_value
is the correct solution here.
Maybe we should document that your session serializer should be able to deal with your user primary key type?
I guess we could also rely on the check framework to make sure it's the case.
comment:5 by , 10 years ago
Cc: | added |
---|
comment:7 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Example project