python - django-smart-selects 无法正常工作
问题描述
我想在我的 django-admin 中链接外键,因此我正在使用 django-smart-selects。我已正确遵循文档
- 安装 django-smart-selects
- 将其添加到 settings.py 中的 installed_apps
- 在我的基本 urls.py 中添加这一行
url(r'^chaining/', include('smart_selects.urls')),
- 相应地改变了我的模型:
class AddressModel(BaseModel):
country = models.ForeignKey(CountryModel, null=True, blank=True, on_delete=models.PROTECT)
state = ChainedForeignKey(StateModel, chained_field=country, chained_model_field=country,
null=True, blank=True, on_delete=models.PROTECT)
city = models.CharField(max_length=200, null=True, blank=True)
并将其添加到我的 setting.py
JQUERY_URL = True
但是每次我尝试从管理员创建地址时,都会收到此错误:-
if path.startswith(('http://', 'https://', '/')): AttributeError: 'bool' 对象没有属性 'startswith'
如何解决这个问题?
解决方案
在 settings.py 中使用USE_DJANGO_JQUERY = True而不是JQUERY_URL = True
推荐阅读
- mysql - 如何在 mariadb 10.2.26 中生成主键 +10000 的列(GENERATED ALWAYS)
- c# - 在 C# 中创建和使用 PowerShell 对象引用
- python - 如何在一个跟踪中写入来自不同服务的跨度?
- video-streaming - 使用 gstreamer 和 janus 从启动多个 rtp 流中识别流
- datastax - 目录未复制到 dse fs
- java - Flood-Fill结束太快,没有回到起始位置
- java - 如何设置 spring.boot 实现的 rest 接口的 put 方法的 Rest 客户端调用?
- sql-server - 我可以将一列的值作为两列返回吗?
- mongodb - MongoDB 修复异常
- matplotlib - Jupyter 笔记本单元格不会拉伸以适应多个绘图