我正在尝试在我的会话中保存日期。我总是收到错误Object of type 'datetime' is not JSON serializable。我发现这这里的Django的文档:stored as seconds since epoch since datetimes are not serializable in JSON.
如何将我的保存expiry_date为秒而不是日期时间?
code = social_ticketing_form.cleaned_data['a']
expiry_date = timezone.now() + timezone.timedelta(days=settings.SOCIAL_TICKETING_ATTRIBUTION_WINDOW)
request.session[social_ticketing_cookie_name(request.event)] = {'code': code, 'expiry_date': expiry_date}
千万里不及你
相关分类