【发布时间】:2015-06-28 23:55:06
【问题描述】:
我是新 python 所以使用 post 方法 用我的数据
{
"name":"test nassssme123",
"email_id":"test123@gmail.com",
"subject":"test Subject",
"message":"test Message",
"date":"2222222212"
}
那个时候给我错误
{
"error_message": "'Options' object has no attribute 'module_name'",
"traceback": "Traceback (most recent call last):\n\n File \"/home/rahul/pyworld/local/lib/python2.7/site-packages/tastypie/resources.py\", line 201, in wrapper\n response = callback(request, *args, **kwargs)\n\n File \"/home/rahul/pyworld/local/lib/python2.7/site-packages/tastypie/resources.py\", line 432, in dispatch_list\n return self.dispatch('list', request, **kwargs)\n\n File \"/home/rahul/pyworld/local/lib/python2.7/site-packages/tastypie/resources.py\", line 464, in dispatch\n response = method(request, **kwargs)\n\n File \"/home/rahul/pyworld/local/lib/python2.7/site-packages/tastypie/resources.py\", line 1340, in post_list\n updated_bundle = self.obj_create(bundle, **self.remove_api_resource_names(kwargs))\n\n File \"/home/rahul/pyworld/local/lib/python2.7/site-packages/tastypie/resources.py\", line 2104, in obj_create\n return self.save(bundle)\n\n File \"/home/rahul/pyworld/local/lib/python2.7/site-packages/tastypie/resources.py\", line 2251, in save\n bundle.objects_saved.add(self.create_identifier(bundle.obj))\n\n File \"/home/rahul/pyworld/local/lib/python2.7/site-packages/tastypie/resources.py\", line 2232, in create_identifier\n return u\"%s.%s.%s\" % (obj._meta.app_label, obj._meta.module_name, obj.pk)\n\nAttributeError: 'Options' object has no attribute 'module_name'\n"
}
get 方法对我来说很好用
我的包裹是
defusedxml==0.4.1
Django==1.8
django-extensions==1.5.2
django-tastypie==0.12.1
ipython==3.1.0
MySQL-python==1.2.5
python-dateutil==2.4.2
python-mimeparse==0.1.4
six==1.9.0
【问题讨论】:
-
我不明白这一点
-
好的,抱歉,从标签上我猜这是对
tastypie提供的API 端点的发布请求?您如何测试POST请求,您是否有提交的表单或可能使用其他工具? (类似于curl或postman等)
标签: python django python-2.7 tastypie