0

I want to have chained foreign key in my django-admin and thus I am using django-smart-selects. I have followed the documentation properly

  1. Install django-smart-selects
  2. Add it in installed_apps in settings.py
  3. Add this line in my base urls.py
       url(r'^chaining/', include('smart_selects.urls')),
  1. changed my model accordingly:
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)

and added this to my setting.py

JQUERY_URL = True

But everytime I try to create an address from admin, I get this error:-

if path.startswith(('http://', 'https://', '/')): AttributeError: 'bool' object has no attribute 'startswith'

How to solve this?

Aarti Joshi
  • 325
  • 1
  • 8
  • 17

3 Answers3

3

Use USE_DJANGO_JQUERY = True instead of JQUERY_URL = True in your settings.py

0

Use USE_DJANGO_JQUERY = True and JQUERY_URL = False

  • Add this in your html
        <script src="/static/smart-selects/admin/js/chainedfk.js"></script>
        <script src="/static/smart-selects/admin/js/bindfields.js"></script>
Adul M
  • 13
  • 5
0

on the terminal entered 'show static files' then I got two static folders. Django automatically made a smart selectors folder, then I copied the smart selector's folder and pasted it into my only created static file, then resolved all my problems. Thank you.

show static files
Adul M
  • 13
  • 5