Django出现报错'AnonymousUser' object is not iterable
来源:互联网 发布:hadoop java获取文件 编辑:程序博客网 时间:2024/05/16 17:31
django 做的网站出现如下错误:
Exception Type: TypeError Exception Value:'AnonymousUser' object is not iterable
错误代码最终定位在view视图:
if UserFavorite.objects.filter(user=request.user, fav_type=2,av_id=teacher.org.id):
错误分析,此功能必须经过验证登录的用户才能使用,没登录的用户使用了此功能导致报错,解决办法,在报错的代码前面加上如下代码:
if request.user.is_authenticated(): if UserFavorite.objects.filter(user=request.user, fav_type=3, fav_id=teacher.id):
问题解决
阅读全文
0 0
- Django出现报错'AnonymousUser' object is not iterable
- Django 报错 'AnonymousUser' object is not iterable 的解决办法
- scrapy domz报错TypeError: 'float' object is not iterable
- selenium中'WebElement' object is not iterable报错问题
- Python出现TypeError: 'NoneType' object is not iterable
- 'classobj' object is not iterable ?
- 'NoneType' object is not iterable
- python object is not iterable
- “'WebElement' object is not iterable”
- python框架Scrapy报错TypeError: 'float' object is not iterable解决
- python mysql 插入数据报错 Failed processing format-parameters; 'int' object is not iterable
- Scrapy使用shell命令报错scrape shell TypeError: 'float' object is not iterable
- python TypeError: 'int' object is not iterable
- TypeError: ‘NoneType’ object is not iterable
- python 'float'object is not iterable
- TypeError: 'NoneType' object is not iterable
- 启动robot framework报'NoneType' object is not iterable的原因
- 【Python】python "TypeError: 'NoneType' object is not iterable"错误分析
- 5.response,request对象
- Python的json
- 【Java并发学习】之详解线程的点滴2
- 详解JAVA环境变量配置
- Zipper Merge Demo: css3 transform animation
- Django出现报错'AnonymousUser' object is not iterable
- Html5+离线打包创建本地消息
- 生产者消费者问题
- python2与3的差别 字典的attribute:items与iteritems
- 超详细mysql left join,right join,inner join用法分析
- Github桌面端程序上传代码
- [codeforces] 877D. Olya and Energy Drinks (BFS)
- 使用android--建立第一个APP程序
- 单链表基本操作的C语言实现(链式存储结构)