使用xadmin搜索search_fields报错:Related Field got invalid lookup: icontains
一、问题描述
使用xadmin实现Django后台功能时,使用search_fields = [字段名,字段名],在搜索的时候报错Related Field got invalid lookup: icontains
二、问题分析
search_fields 控制可以通过搜索框搜索的字段名称,search_fields=()或search_fields=[],xadmin使用的是模糊查询
报错信息翻译出来为:相关字段的查找无效,因为search_fields中的项不是字符类型,例如字段类型是ForeignKey,则会报错
三、解决方法
删除search_fields中类型不符的项,例如删除字段类型为ForeignKey的项
使用xadmin搜索search_fields报错:Related Field got invalid lookup: icontains的更多相关文章
- Django中search fields报错:related Field has invalid lookup: icontains
models.py 文件 # coding:utf8from django.db import models class Book(models.Model): name = model ...
- related Field has invalid lookup: icontains 解决方法
models.py 文件 # coding:utf8 from django.db import models class Book(models.Model): name = mod ...
- Django_xadmin_TypeError: Related Field got invalid lookup: icontains
问题: 当我在给某一张表加上外键搜索的时候,会出现 TypeError: Related Field got invalid lookup: icontains 问题原因: a 表关联 b表,也就是说 ...
- Django admin模块使用search时报错:django.core.exceptions.FieldError: Related Field got invalid lookup: contains
日志如下: <class 'django.core.handlers.wsgi.WSGIRequest'> ------------registered_admins: {'spaceCl ...
- SpringCloud报错: "Field discoveryClient in com.controller.DcController required a bean of type 'com.netflix.discovery.DiscoveryClient' that could not be found."
SpringCloud报错: "Field discoveryClient in com.controller.DcController required a bean of type 'c ...
- 报错:Unsupported field: HourOfDay
报错:Unsupported field: HourOfDay 这个错误就比较搞笑也比较低级了. 代码如下 LocalDate now = LocalDate.now(); String year = ...
- Vue报错之"[Vue warn]: Invalid prop: type check failed for prop "jingzinum". Expected Number with value NaN, got String with value "fuNum"."
一.报错截图 [Vue warn]: Invalid prop: type check failed for prop "jingzinum". Expected Number w ...
- 解决spring mvc 上传报错,Field [] isn't an enum value,Failed to convert value of type 'java.lang.String[]' to required type '
没有选择附件,但是点击上传按钮的时候会报错. 之前不选择文件,直接上传空文件是可以的,后来不知道改了什么就不行了. 错误信息: -- :: [http--] TRACE org.springframe ...
- xadmin 数据添加报错: IndexError: list index out of range
报错现象 xadmin 集成到项目后进行添加数据的时候报错 具体如下 黄页 后端 具体报错定位 报错分析 点击这里 报错解决 源码 input_html = [ht for ht in super(A ...
随机推荐
- Vue2学习笔记:组件(Component)
组件 组件(Component)是 Vue.js 最强大的功能之一.组件可以扩展 HTML 元素,封装可重用的代码.在较高层面上,组件是自定义元素, Vue.js 的编译器为它添加特殊功能.在有些情况 ...
- 【Kettle】4、SQL SERVER到SQL SERVER数据转换抽取实例
1.系统版本信息 System:Windows旗舰版 Service Pack1 Kettle版本:6.1.0.1-196 JDK版本:1.8.0_72 2.连接数据库 本次实例连接数据库时使用全局变 ...
- 查看windows所有exe的启动参数。
在cmd中输入 wmicprocess 即可查看到所有进程的启动参数和运行参数.
- [翻译] GiFHUD
GiFHUD progress hud for displaying only animated gif images. no labels (for now) 状态指示器,仅仅用来显示gif图片,不 ...
- openweathermap-免费的天气预报接口
openweathermap-免费的天气预报接口 其官方网址为:http://www.openweathermap.org/api 静态截图: 具备以下的一些特点: 1. Current weathe ...
- KInect AR沙盒制作的一点小经验
最近在微博上看到这样一条 微博 >点这看< 看起来非常有意思,就去Google了一下如何制作. 没想到这是一个开源项目,而且还告诉你如何安装 OK,接下来就说说我的制作过程. 首先,先放 ...
- Hadoop HBase概念学习系列之HBase里的存储数据流程(二十三)
这个,很简单,但凡是略懂大数据的,就很清楚,不多说,直接上图.
- 利用skipList(跳表)来实现排序(待补充)
用于排名的数据结构 一般排序为利用堆排序(二叉树)和利用skipList(跳表)的方式 redis中SortedSet利用skipList(跳表)来实现排序,复杂度为O(logn),利用空间换时间,类 ...
- 个人作业2:APP案例分析--腾讯动漫
第一部分 调研,评测 个人第一次上手体验 以往看漫画就是在浏览器直接搜索在网页上看,直到用了腾讯动漫APP,我才摒弃这个很low的方法.腾讯动漫直接用qq就可以登陆,有更齐全的漫画分类,更清晰的画质, ...
- memset struct含有string的崩溃
2019/4/2 补充一下 这里如果填充为0,则不会崩溃,填充为非0时,再次调用赋值就会崩溃 推测非0拷贝破坏了string内部的数据结构,不要对任何类使用memset https://blog.cs ...