django-smart-selects无法正常工作

时间:2020-05-11 10:08:07

标签: python django django-models django-admin django-smart-selects

我想在django-admin中链接外键,因此我正在使用django-smart-selects。 我已经正确遵循了文档

  1. 安装django-smart-selects
  2. 将其添加到settings.py中的installed_apps中
  3. 将此行添加到我的基本urls.py
       url(r'^chaining/', include('smart_selects.urls')),
  1. 相应地更改了我的模型:
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)

并将其添加到我的设置中。py

JQUERY_URL = True

但是每次我尝试从管理员创建地址时,都会出现此错误:-

如果path.startswith(('http://','https://','/')): AttributeError:“ bool”对象没有属性“ startswith”

如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

在设置中使用 USE_DJANGO_JQUERY = True 代替 JQUERY_URL = True

相关问题