更新时间:2021-10-17 23:18:35
只要您的 Author
模型类具有 AUTH_USER_MODEL
您正在使用的行(默认为 auth.User
)行:
As long as your Author
model class has a foreign key to the AUTH_USER_MODEL
you're using (the default is auth.User
) the line:
author.user = UserProfile.objects.get(request.user)
应为:
author.user = request.user