Django报:builtin_function_or_method' object is not iterable
def detail(request,hero_id):
hero=models.HeroInfo.objects.get(id=hero_id)
return render_to_response('detail.html',{'detail_obj':hero})
原因为视图获取参数时候 写成了(id,hero_id),改成如上的(id=hero_id)即可解决。
Django报:builtin_function_or_method' object is not iterable的更多相关文章
- DJANGO问题--Error: ‘ManyRelatedManager’ object is not iterable
http://www.itblah.com/django-error-manyrelatedmanager-object-iterable/ Django: Error: ‘ManyRelatedMa ...
- for遍历用例数据时,报错:TypeError: list indices must be integers, not dict,'int' object is not iterable解决方法
一:报错:TypeError: list indices must be integers, not dict for i in range(0,len(test_data)): suite.addT ...
- python报错Nonetype object is not iterable
https://www.cnblogs.com/zhaijiahui/p/8391701.html 参考链接:http://blog.csdn.net/dataspark/article/detail ...
- 'ManyRelatedManager' object is not iterable
先看下面的代码: class Worker(models.Model): departments = moels.ManyToManyField(Department, verbose_name=u& ...
- Python问题:'Nonetype' object is not iterable
参考链接:http://blog.csdn.net/dataspark/article/details/9953225 [解析] 这个错误提示一般发生在将None赋给多个值时. [案例] 定义了如下的 ...
- 'WebElement' object is not iterable
checkbox.html源码: <html> <head> <meta http-equiv="content-type" content=&quo ...
- TypeError: 'ExcelData' object is not iterable
今天写了个测试的代码,结果在执行test_register.py文件在调用readexcle.py的时候一直报错TypeError: 'ExcelData' object is not iterabl ...
- python TypeError: 'NoneType' object is not iterable
list(set(map(lambda tp_id : tp_id if not ('#' in tp_id) and len(tp_id.strip().replace('\n', '')) > ...
- TypeError: 'TestCase' object is not iterable
这个异常呢其实是因为我对list没有足够熟悉 我一开始很疑惑,明明已经正确返回testcase对象了呀,为啥会报TypeError: 'TestCase' object is not iterable ...
随机推荐
- Python课程之元组
元组(Tuple) 一.定义: 与列表(list)不同的是,元组不支持修改,但是若元组中的元素本身是可变对象,如列表,则可以修改.元素之间用逗号隔开,并且元素的类型可以任意. 二.操作: 1.创建:直 ...
- 浅谈C语言中断处理机制
一.中断机制 1.实现中断响应和中断返回 当CPU收到中断请求后,能根据具体情况决定是否响应中断,如果CPU没有更急.更重要的工作,则在执行完当前指令后响应这一中断请求.CPU中断响应过程如下:首先, ...
- osd char
osdchar.c #include<stdio.h> #include "TimeNewRoman.h" #define TNR 0x00 //Time New Ro ...
- configure: error : no acceptable C compiler found in $PATH
先要用yum install yum-fastestmirror更新下源 # yum -y install gcc
- 在 Windows 上安装 TensorFlow(转载)
在 Windows 上安装 TensorFlow windows下配置安装Anaconda+tensorflow Spyder——科学的Python开发环境 Windows7 安装TensorFlow ...
- Yarn源码分析之MRAppMaster上MapReduce作业处理总流程(二)
本文继<Yarn源码分析之MRAppMaster上MapReduce作业处理总流程(一)>,接着讲述MapReduce作业在MRAppMaster上处理总流程,继上篇讲到作业初始化之后的作 ...
- Vuex 2 入门与提高。
从计数器开始 让我们从一个简单的计数器,开始进入Vuex 的世界: 计数器应用的数据模型很简单:使用一个counter属性来表示计数器的 当前值就够了. 在Vue实例的created钩子 中,应用启动 ...
- 2015-2016ACM-ICPC NEER northern-subregional-contest C Concatenation
可以在这里提交: http://codeforces.com/gym/100801 题目大意: 给出两个由小写字母组成的字符串S,T,从S中取一个非空前缀,从T中取一个非空后缀,拼接成一个新的字符串. ...
- python 自动化之路 day 19 Django基础[二]
Django - 路由系统 url.py - 视图函数 views.py - 数据库操作 models.py - 模板引擎渲染 - HttpReponse(字符串) - render(request, ...
- 一些常用的html css整理--文本长度截取
div+css设置列表div超出部分显示...(单行文本) width:200px; //指定宽度: overflow:hidden; //将超出内容隐藏 text-overflow:ellipsis ...