New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple chained selects being cleared out after page refresh. Only first one in chain retains value. #292
Comments
Basically it loads all the dropdowns from the database during the reload and you can actually see them for a second. Then Country through City get returned to their initial empty_label values. If you use Inspection on those dropdowns they do show the correct values. In the form above, Region is simply a foreignkey field that serves as the start of the chaining that begins with subregion through city. |
Their 'data-value' tags are set correctly for each dropdown (when using Chrome inspect) , but what shows is the empty-value. I've also noticed that when I removed the ajax script for jquery.min.js they all load as expected, but then the triggers obviously don't work and then django-smart-selects functionality doesn't work. I've tried several different version of 'jquery.min.js' and all have the same output so I doubt that's the problem. Is there an option I'm missing that could fix this? |
Here are my models:
and here is the model that brings all the chainedforeignkeys together.
|
Here are my url.py patterns:
And here are my scripts for my Base file:
And finally here are my jquery entries in settings.py:
|
Is anyone monitoring questions here...curious why this is getting ignored? |
@matthewjennings73 the package is being transitioned to jazzband, and that is taking time. I did some work to fix it so it works for us, here: https://github.com/jazzband/django-smart-selects/commits/issue-253-chainedfk-is-not-defined Please let me know if you try that branch. |
Great thanks for the reply. Will give it a go and let you know! |
Yeah I tried that and still getting same behavior. |
Are there any example of multiple chained selects using this package? Like I said, the first one works, but then then everything after doesn't seem to repopulate? |
I added another chained select to Please check that you are not running into browser cache issues when trying You can try the
Then login with admin/admin at http://127.0.0.1:8000/admin/ Hope this helps :) |
Checking to see if this will resolve my issues. |
Still not solving my issues. My selections still appear and then disappear during the refresh of the change_form. It seems like there is something in jquery that is causing this. I have tried so many things to correct this, but it doesn't seem to fix the issue....very happy to donate to the development of this to get this working! |
@matthewjennings73 isn't the test app working for you? |
I also have this problem. It's not normal in chrome, but it's good in safari |
@shishinanliao did you try the test described in this issue? |
Yes, I have |
Can someone reproduce the problem using the test app provided in django-smart-selects? |
I just tested Django 3.0 and this works as expected in the test app (http://localhost:9000/admin/test_app/location/1/change/). Could you please add more details? is the console showing any Javascript error? |
Upgraded to Django 3.0 and added the changes from above and still same behavior and no erros in javascript in console in google inspection. |
I am getting this now in conosle in pycharm which shows me the right data is getting to each field...it's just somehow being set back to blank...
|
So it worked in Explorer but not in chrome now? Same as @shishinanliao. ANy ideas how to fix that? |
Okay so after clearing out passwords autofill, etc. from Google Chrome settings, it now is acting as expected. Thanks for the assistance and letting me know how to get to a solution! |
A lot of time and effort from all involved here so thanks. Now working by upgrading to Django 3.0. Specail thanks to @manelclos and @shishinanliao! |
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]
master
branch of django-smart-selects.smart_selects
app.models.py
,forms.py
, andviews.py
with problems.Steps to reproduce
Using django-smart-selects 1.5.4 (js-unlining-fixes; Master didn't work as expected)
Actual behavior
Expected behavior
The text was updated successfully, but these errors were encountered: