django Error during template rendering,TypeError: __str__ returned non-string (type int)
来源:互联网 发布:魔兽世界完整剧情知乎 编辑:程序博客网 时间:2024/06/11 02:35
初学django时在django 站点管理中遇到的错误,其实是个很简单的问题,今天把问题解决方案分享一下,希望可以对遇到同样问题的朋友有所帮助。
问题描述:在django站点管理中,在某个对象的列表中,点击主键到该对象的编辑页面出现如下错误:
这个问题的主要原因是该对象的主键不是一个字符串类型的主键,所以这里把models中的def __str__(self):的返回结果处理一下就好了,具体如下:
修改完成后保存再次点击就OK 了!
0 0
- django Error during template rendering,TypeError: __str__ returned non-string (type int)
- __str__ returned non-string (type int)
- Django查询models对象报错:TypeError: __str__ returned non-string (type decimal.Decimal)
- Django rest framework __str__ returned non-string (type NoneType)
- Django rest framework 返回错误信息 __str__ returned non-string (type NoneType)
- django报错:TypeError: __str__returned non-string (type bytes)
- TypeError: iter() returned non-iterator of type
- TypeError: iter() returned non-iterator of type
- django遇到TypeError: can't multiply sequence by non-int of type 'tuple'
- TypeError: iter() returned non-iterator of type 'Fibs'
- TypeError: iter() returned non-iterator of type 'xx' 从Python3开始,要用__next__
- TypeError: can't multiply sequence by non-int of type 'float'
- C++ non type template parameters
- error: int-array initialized from non-wide string 和wchar_t
- template non-type parameter 非类型参数
- Django Template Error 及解决方法
- error: cannot pass objects of non-trivially-copyable type ‘std::string {aka class std::basic_string
- TypeError: not all arguments converted during string formatting
- Java可变参数
- Spring MVC面试题
- IIC设备驱动程序(八)————dev-interface
- 简述c++命名规则
- JEECG多图上传+回显
- django Error during template rendering,TypeError: __str__ returned non-string (type int)
- 第一个只出现一次的字符(Java实现)
- c++作业6
- JPQL全称Java Persistence Query Language
- 补c++第二次作业
- git修改上一次提交之前的提交git commit --fixup
- Emment前端开发
- php-fpm以root身份运行
- java.lang.IllegalStateException: @Resource annotation requires a single-arg method