jazzband / django-smart-selects

chained and grouped selects for django forms
https://django-smart-selects.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.1k stars 348 forks source link

'bool' object has no attribute 'startswith' #235

Closed brayan15 closed 6 years ago

brayan15 commented 6 years ago

hello, I have a problem, this is my model: from smart_selects.db_fields import ChainedForeignKey

city = ChainedForeignKey(City, chained_field="state", chained_model_field="state", show_all=False)

also I added url and jquery on settings

blag commented 6 years ago

I'm immediately closing this issue without looking at it because it doesn't contain the information I asked for in the issue template I created for this repo. Feel free to reopen this issue once you have filled out the issue template at:

https://github.com/coderholic/django-cities/blob/master/ISSUE_TEMPLATE.md

by copying that, pasting it into your issue form:

issue_template

and filling out all of the necessary information:

issue_template_2

Once you have done that I will take a look at this issue. Thanks!

(These pictures are just examples from a different repository but the process is the same.)

Also, please format your code with GitHub Flavored Markdown by using fenced blocks:

```python
def this_python_function():
    # Get rendered properly
    return awesome
```

gets rendered as:

def this_python_function():
    # Get rendered properly
    return awesome
duxiaoyang06 commented 6 years ago

I occured the same problem when I installed the package . Part of the error info :File "/usr/local/Cellar/python3/3.6.2'/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/forms/widgets.py", line 88, in absolute_path

duxiaoyang06 commented 6 years ago

Request Method: | GET
-- | --
http://127.0.0.1:8000/admin/cms/content_info/11/change/
2.0.3
AttributeError
'bool' object has no attribute 'startswith'
/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/forms/widgets.py  in absolute_path, line 88
/usr/local/bin/python3
3.6.2
['/Users/duxiaoyang/Desktop/code/python/cms_django',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django_smart_selects-1.5.4-py3.6.egg']
星期二, 10 四月 2018 10:18:21 +0000

Request Method: | GET
-- | --
http://127.0.0.1:8000/admin/cms/content_info/11/change/
2.0.3
AttributeError
'bool' object has no attribute 'startswith'
/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/forms/widgets.py  in absolute_path, line 88
/usr/local/bin/python3
3.6.2
['/Users/duxiaoyang/Desktop/code/python/cms_django',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django_smart_selects-1.5.4-py3.6.egg']
星期二, 10 四月 2018 10:18:21 +0000

Request Method: | GET
-- | --
http://127.0.0.1:8000/admin/cms/content_info/11/change/
2.0.3
AttributeError
'bool' object has no attribute 'startswith'
/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/forms/widgets.py  in absolute_path, line 88
/usr/local/bin/python3
3.6.2
['/Users/duxiaoyang/Desktop/code/python/cms_django',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages',  '/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django_smart_selects-1.5.4-py3.6.egg']
星期二, 10 四月 2018 10:18:21 +0000

Error during template rendering

In template /usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/contrib/admin/templates/admin/base.html, error at line 3
'bool' object has no attribute 'startswith'
duxiaoyang06 commented 6 years ago

Do you have solved this problem? @brayan15

markddavidoff commented 7 months ago

To summarize for those having this issue, this happens if you set the JQUERY_URL = True as it looks like it is expecting a value not a boolean.

setting Use USE_DJANGO_JQUERY = True instead of JQUERY_URL = True in your settings.py as recommended in https://stackoverflow.com/questions/61727169/django-smart-selects-not-working-properly worked for me.

luzdealba commented 1 month ago

setting Use USE_DJANGO_JQUERY = True instead of JQUERY_URL = True in your settings.py as recommended in https://stackoverflow.com/questions/61727169/django-smart-selects-not-working-properly worked for me.

That did it for me.