在用django框架中遇到一个错误,是模型编写中出的错误

TypeError: coercing to Unicode: need string or buffer, ChatRoom found

解决办法:

我的models.py文件:

StackOverFlow上找到了回答:

因为我的ChartAccount 中room是外键,所以self.room 指向ChatRoom,不是一个string or buffer。

可改为self.room.name 或者去掉

TypeError: coercing to Unicode: need string or buffer, ChatRoom found的更多相关文章

  1. coercing to Unicode: need string or buffer, int found报错

    转为string类型 str(a)

  2. Django admin coercing to Unicode: need string or buffer, tuple found

    见 http://stackoverflow.com/questions/29762306/django-admin-coercing-to-unicode-need-string-or-buffer ...

  3. coercing to Unicode: need string or buffer, geoprocessing value object found

    workbook.save(outxls),保存xls,出现上面的错误原因是:outxls不是错误 arcpy.AddMessage("--------"+outxls) cann ...

  4. a=re.findall('b',c)报错提示:TypeError:expected string or buffer

    目的:想通过findall选取某个unicode编码的字符串列表(列表里面有元组) 问题:报错[TypeError:expected string or buffer] 现在测试下: 定义一个有元组的 ...

  5. 解决:error: Cannot fetch repo (TypeError: expected string or buffer)

    同步源码,问题重现: Fetching project platform/external/libopus Fetching project repo error: Cannot fetch repo ...

  6. TypeError: expected string or buffer的解决方法

    错误种类:TypeError: expected string or buffer 具体错误解释:这是因为返回的变量不是字符类型,而导致此错误 具体解决方法:在具体程序段前加if判断语句,判断程序返回 ...

  7. 导入json文件报错,TypeError expected string or buffer

    导入json文件报错,TypeError expected string or buffer 原因:用字符串赋值后,python会把双引号转换为单引号 import json data = [{&qu ...

  8. 【Download error:TOO MANY REQUESTS】&【TypeError:excepted string or buffer】

    <用python写网络爬虫>,1.4.4链接爬虫,运行时,遇到错误: Download error:TOO MANY REQUESTS Traceback(most recent call ...

  9. 关于Python json解析过程遇到的TypeError: expected string or buffer

    关于Python json解析过程遇到的问题:(爬取天气json数据所遇到的问题http://tianqi.2345.com/) part.1 url——http://tianqi.2345.com/ ...

随机推荐

  1. 給eclipse添加字体,设置字体

    问题? 一般情况的更换字体就是:1.首先打开Window ---> Preferences ---> General ---> Appearance ---> Colors a ...

  2. Linux:-拷贝或传送文件的技巧

    <---拷贝目录如何做到排除文件?常用命令cp,用法比较LOW---> tar -cf - ./* --exclude="nohup.out" | (cd /opt/ ...

  3. 【转】Android Https服务器端和客户端简单实例

    转载地址:http://blog.csdn.net/gf771115/article/details/7827233 AndroidHttps服务器端和客户端简单实例 工具介绍 Eclipse3.7 ...

  4. js如何判断获取到的值是否在数组中

    很简单,定义一个数组,判断下就得了. var arrayList = [1,2,3,4]; arrayList .indexOf(2); 返回0 arrayList .indexOf(6); 返回1 ...

  5. Oracle数据库的表结构 简单表的建立

  6. linq+映射数据库调用方法

      关于这一块.我在网上了解了很多.但是都没有找到自己想要的.通过各方面了解在linq 中调用映射的数据库函数以及存储过程方法如下. 1.传递对象参数//*注意:参数必须和你函数或者存储过程的参数一样 ...

  7. SpringMVC框架下实现JSON(类方法中回传数据到jsp页面,使用jQuery方法回传)

    JSON的实现,即将需要的数据回传到jsp页面: 1>.加入实现Json的三个架包到lib中:2>.目标方法上边加入注解,需要返回的值3>.在jsp页面中书写jQuery方法: ec ...

  8. jQuery 弹出层脚本

    直接贴代码: $.extend({ closeBox: function (o, x, fn) { $('#' + o).fadeOut(500, function () { if (fn & ...

  9. 2017年1月4日 星期三 --出埃及记 Exodus 21:30

    2017年1月4日 星期三 --出埃及记 Exodus 21:30 However, if payment is demanded of him, he may redeem his life by ...

  10. EXCEL如何提取文字中包含的数字?

    方法1:=IF(ISERROR(FIND("-",A1)),"","-")&MID(SUM(MID(101&A1,2+LAR ...