Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在从 Tastypie 中的 ModelResource 派生的类的脱水方法中获取登录用户。
我怎样才能做到这一点?
提前致谢。
找到了。bundle中有request对象;
def dehydrate(self,bundle): logged_user = bundle.request.user ... return bundle
这工作正常。