int() argument must be a string or a number, not 'SimpleLazyObject'

前端 未结 5 748
南方客
南方客 2020-12-13 19:33

I got, following Error messages,

TypeError at /save/ int() argument must be a string or a number, not \'SimpleLazyObject\'

Whi

5条回答
  •  暖寄归人
    2020-12-13 19:45

    The likely cause is that you're setting user = request.user, where request.user is not a real User object, but a SimpleLazyObject instance. See django: Purpose of django.utils.functional.SimpleLazyObject? for more details, but using request.user.id should fix your issue.

提交回复
热议问题