Django的Tastypie:你怎么在Bundle访问(HTTP)请求对象? [英] Django-Tastypie: How Do You Access (Http)request object in the Bundle?

查看:115
本文介绍了Django的Tastypie:你怎么在Bundle访问(HTTP)请求对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要访问我的资源的脱水型Htt prequest对象
方法。

I need to access the HttpRequest object in my Resource's dehydrate method.

在文档,它表明bundle.request是一个有效的属性(这是
在resources.html页)。当我尝试将其添加到我的code,我得到一个
错误声称捆绑'对象有没有属性'的要求。
是什么给了?

In the docs, it shows that bundle.request is a valid attribute (it's in the resources.html page). When I try to add it to my code, I get an error claiming that Bundle' object has no attribute 'request'. What gives?

推荐答案

我刚刚有同样的问题,但找到了正确的答案在这里:
<一href=\"http://groups.google.com/group/django-tastypie/tree/browse_frm/thread/801f44af3f2dbe7b/a36f303380eacf96\" rel=\"nofollow\">http://groups.google.com/group/django-tastypie/tree/browse_frm/thread/801f44af3f2dbe7b/a36f303380eacf96

I just had the same problem, but found the correct answer over here: http://groups.google.com/group/django-tastypie/tree/browse_frm/thread/801f44af3f2dbe7b/a36f303380eacf96

似乎Django的美味馅饼版本0.9.9没有这个属性,但版本0.9.10呢!

it seems django-tasty-pie version 0.9.9 didn't have this attribute but version 0.9.10 does!

所以,如果使用扩建,期待中buildout.cfg
下版本:
搜索 Django的tastypie = 0.9.9

so if you use buildout, look in to buildout.cfg under versions: search for django-tastypie = 0.9.9

删除它,看看你的安装什么选秀权,或是更换:

remove this one and see what your install picks or replace it with:

django-tastypie = 0.9.10

我仍然有这个问题,所以开了一个新的链接,请参见:

I still have this problem, so opened a new link, see:

Django的tastypie:无法访问bundle.request在脱水(个体经营,束)

在上面的问题,我发现,在使用0.9.10是不够的,版本1.0.0测试版应该做的TRIC ..

in the question above I found out, that using 0.9.10 is not enough, version 1.0.0 beta should do the tric..

这篇关于Django的Tastypie:你怎么在Bundle访问(HTTP)请求对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆