我是新的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
答案 0 :(得分:0)
所有关于版本的Django 1.8 和Tastypie现在不能正常合作。至少不能像我们之前用pip那样安装。 如果你想让它们工作安装合并的tastypie代码支持Django 1.8这样:
pip install -e https://github.com/django-tastypie/django-tastypie#egg=TastyPie
并更新您的requirements.txt。删除 django-tastypie == 0.12.1 并运行:
pip freeze> requirements.txt