강의

멘토링

커뮤니티

Inflearn Community Q&A

msra9my63604's profile image
msra9my63604

asked

Introduction to Web Development for Python Users A to Z Django + Bootstrap

Implementing a Comment writing window

request.user가 SimpleLazyObject를 반환합니다.

Written on

·

552

0

19:34처럼 comment.author = request.user를 하면 아래와 같은 에러가 발생합니다.

ValueError: Cannot assign "<SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x000002CE4219A0A0>>": "Comment.author" must be a "User" instance.

request.user가 SimpleLazyObject를 반환하는거 같은데,
PostCreate에서 request.user를 사용할 때는 문제없이 잘 되는데 여기에선 에러가 나는 이유를 모르겠습니다.

bootstrapdjangopython

Answer 2

0

Minsub Yoon님의 프로필 이미지
Minsub Yoon
Questioner

강좌 뒷부분을 보고 해결됬습니다. 감사합니다.

0

SungYong Lee님의 프로필 이미지
SungYong Lee
Instructor

"같다."의 의미로 사용할 때는 =가 아니라 == 입니다. 이 부분을 실수한게 아닐까요?

msra9my63604's profile image
msra9my63604

asked

Ask a question