if user:
payload = {
'id': user.pk,
'username': user.username,
'staff': user.email,
'exp': datetime.utcnow()
I think that datetime.utcnow() returns a datetime object, not a string, and
I don't think it can be serialized directly. You should try converting that
object to a string in the right format. As a test, substitute a static
string containing a date and time in whatever format you need. I'm not in
front of an interpreter so I can't test, but this seems to back up my
theory:
https://code-maven.com/serialize-datetime-object-as-json-in-python
Forgot to mention, you may also want to take a look at the built-in JSON
encoder, which handles datetime objects:
https://docs.djangoproject.com/en/1.11/topics/serialization/#djangojsonencoder
-James
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWTP-CEwG00YP1pVc0s1PcnHbgMgMTAO1118XYJ%2B9Dt0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.