jazzband/django-smart-selects

chainedforeignkeyfeild don't render any values

ofathy opened this issue · 6 comments

You MUST use this template when reporting issues. Please make sure you follow the checklist and fill in all of the information sections below.


All versions of django-smart-selects prior to version 1.2.8 are vulnerable to an XSS attack as detailed in issue 171. As a result, all previous versions have been removed from PyPI to prevent users from installing insecure versions. All users are urged to upgrade as soon as possible.

Checklist

Put an x in the bracket when you have completed each task, like this: [x]

  • [x ] This issue is not about installing previous versions of django-smart-selects older than 1.2.8. I understand that previous versions are insecure and will not receive any support whatsoever.
  • I have verified that that issue exists against the master branch of django-smart-selects.
  • [ x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • [ x] I have debugged the issue to the smart_selects app.
  • [x ] I have reduced the issue to the simplest possible case.
  • I have included all relevant sections of models.py, forms.py, and views.py with problems.
  • [ x] I have used GitHub Flavored Markdown to style all of my posted code.

Steps to reproduce

Actual behavior

Expected behavior

In the branch js-unlinting-fixes in admin page, the 1st chained foreign key which is dependent on a foreign key is rendered correctly for me.
However, the 2nd-degree (or more) chained foreign key field, which is dependent on the 1st chained foreign key field, is not rendered correctly. If the 2nd-degree (or more) chained foreign key field was previously edited or has a previously set data-value before loading the admin page, what is being rendered is the empty option and not the previously-set value.

#260 fixes this issue for me.

I'm using ChainedForeignKey for admin page. The values in the 2nd drop-down is not rendered at all. When I set 'show_all=True', then all the values (unfiltered) are rendered.
What is the fix?

Are you using js-unlinting-fixes branch?

I did pip install 'git+https://github.com/digi604/django-smart-selects.git@js-unlinting-fixes' and even an upgrade from issue#253 solution.
I also did 'collect static' and added the chainedfk.js(), chainedm2m.js() to the Base.html of my admin template.
Finally works like charm with IE and Firefox. But with Chrome it's the never ending error 'Uncaught ReferenceError: chainedfk is not defined' at line12 of bindfields.js. Nevertheless, javascript is enabled in chrome.

@ofathy can you reproduce with latest master version?

Closing due to inactivity