我正在使用 django 表单向导,它需要一个 done 方法。
def done(self, form_list, **kwargs):
#Making an instance of Location
location = Location(
manager = User.objects.get(username=request.user.username)
#more stuff
)
除了我收到以下错误:
global name 'request' is not defined on line (the line with manager assignment)
不太确定我能做些什么来解决这个问题。我应该将请求插入到 done 方法中吗?这甚至有意义吗?其他人如何处理这个问题?