AttributeError: 'ForeignKey' object has no attribute 're' 解决办法
使用
field_object.rel.model.objects.filter(**db_condition)
报错

forekey中存在rel,为什么不能调用?


通过以下语句观察
print(field_object)
print(type(field_object))
print(db_condition)
print(field_object.__dic__)

故:
self.remote_field = rel
sSO 将rel改成remote_field即可
field_object.remote_field.model.objects.filter(**db_condition)
AttributeError: 'ForeignKey' object has no attribute 're' 解决办法的更多相关文章
- Python错误:AttributeError: 'generator' object has no attribute 'next'解决办法
今天在学习生成器对象(generation object)运行以下代码时,遇到了一个错误: #定义生成器函数def liebiao(): for x in range(10): yield x#函数调 ...
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- 提示AttributeError: 'module' object has no attribute 'HTTPSHandler'解决方法
今天在新机器上安装sqlmap,运行提示AttributeError: 'module' object has no attribute 'HTTPSHandler' 网上找了找资料,发现一篇文章ht ...
- 解决 AttributeError: 'ForeignKey' object has no attribute 're'
解决办法 # print('rel...',filter_field_obj.re.to.objects.all()) print("rel...", filter_field_o ...
- python3 AttributeError: 'NoneType' object has no attribute 'split'
from wsgiref.simple_server import make_server def RunServer(environ, start_response): start_response ...
- Django项目与mysql交互进行数据迁移时报错:AttributeError: 'str' object has no attribute 'decode'
问题描述 Django项目启动,当我们执行命令 python manage.py makemigrations 出现如下错误: File , in last_executed_query query ...
- AttributeError: 'NoneType' object has no attribute 'split' 报错处理
报错场景 social_django 组件对原生 django 的支持较好, 但是因为 在此DRF进行的验证为 JWT 方式 和 django 的验证存在区别, 因此需要进行更改自行支持 JWT 方式 ...
- AttributeError: 'dict' object has no attribute 'encode'
首先这是一个很简单的 运行时错误: 错误分析: AttributeError:属性错误,造成这种错误的原因可能有: 你尝试访问一个不存在的属性或方法.检查一下拼写!你可以使用内建函数 dir 来列出存 ...
- flask 表单填充数据报错!AttributeError: 'dict' object has no attribute 'getlist'
报错信息: AttributeError: 'dict' object has no attribute 'getlist' 解决: 虽然是小毛病,不得不说还是自己太粗心大意了.
随机推荐
- jq 正则
if(_each_this_type_name == 'post_num'){ var patrn = /^[a-zA-Z0-9]{3,12}$/; if(!patrn.test(_each_this ...
- lightoj 1007 - Mathematically Hard 欧拉函数应用
题意:求[a,b]内所有与b互质个数的平方. 思路:简单的欧拉函数应用,由于T很大 先打表求前缀和 最后相减即可 初次接触欧拉函数 可以在素数筛选的写法上修改成欧拉函数.此外本题内存有限制 故直接计算 ...
- 两小时快速构建微信小程序
小程序在2017年1月上线之初,被社会极力吹捧,刻意去将其制造为一个“风口”,透支其价值.但是在之后一个月里,石破天惊迅速归为沉寂.媒体又开始过度消费小程序,大谈其鸡肋之处. 个人认为小程序的一个分水 ...
- hdu 4190 Distributing Ballot Boxes(贪心+二分查找)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4190 Distributing Ballot Boxes Time Limit: 20000/1000 ...
- python进行机器学习(三)之模型选择与构建
Scikit-Learn库已经实现了所有基本机器学习的算法,可以直接调用里面库进行模型构建. 一.逻辑回归 大多数情况下被用来解决分类问题(二元分类),但多类的分类(所谓的一对多方法)也适用.这个算法 ...
- aptitude约等于apt-get的工具
如题,与之不同的是其会将依赖的程序也给删除. https://baike.baidu.com/item/aptitude/6849487?fr=aladdin 以下是一些常用 aptitude命令,仅 ...
- 关于$->aaa->bbb();的困惑
第21行为什么可以调用test类的aa方法呢? 答:因为前一行(20)其已经被实例化了.所以现在的$this->obj其实可以相当于是一个对象. 20行和21行也可以写成如下 $xxoo = n ...
- 【Python学习笔记】Pandas库之DataFrame
1 简介 DataFrame是Python中Pandas库中的一种数据结构,它类似excel,是一种二维表. 或许说它可能有点像matlab的矩阵,但是matlab的矩阵只能放数值型值(当然matla ...
- Yii 1.1.17 五、分页类、关联模型、权限验证与默认页面跳转
一.分页类使用 1.在控制器中 // 实例化 $criteria = new CDbCriteria(); $articleModel = Article::model(); // 分页 $total ...
- linux===进程操作
ps -ef ps -aux|grep chat.js a:显示所有程序 u:以用户为主的格式来显示 x:显示所有程序,不以终端机来区分 kill -9 nohup python da.py & ...