Open mohandeath opened 7 years ago
This is with the current git master
branch? I assume so since you said the admin was working just fine, I'm just double checking.
Fire up your browser debugging console and see what HTTP requests are happening please. Is the AJAX request firing? What does the AJAX request look like? What does the AJAX response look like?
Also, if you are using the master
branch, try rewinding it to commit 9eb75a5d207aa24a79e8c161ff826c09c828bd18 and see if that fixes it.
hey , i used pip to install this , i don't know which version or commit/branch it ts but will try out last ones . -> about AJAX calls , i see no call from ajax . totally clear . but i figured out there's problem with jquery
$(document).ready(function() {
chainedfk.init(chainfield, url, id, value, empty_label, auto_choose);
});
})(jQuery || django.jQuery);
and also i tried these things in settings but same results :
USE_DJANGO_JQUERY = False
JQUERY_URL = 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
is there anything wrong with this part ? i copied code from lib , couldn't find any docs
ct = ChainedModelChoiceField(
queryset=City.objects.all(),
empty_label=_('select city'),
label=_('city'),
to_app_name='core', to_model_name='city', chained_field='province', chained_model_field='province',
foreign_key_app_name='core', foreign_key_model_name='address', foreign_key_field_name='city',
show_all=False, auto_choose=False,
)
I just released version 1.3.3 to PyPI and GitHub, although I doubt that contains fixes for this issue.
Take a look at this suggestion in #116 and see if that works for you.
@mohandeath - Thanks for the example. I had a hard time figuring out how to use ChainedModelChoiceField in a form! Your code helped me figure the last bits out.
@blag, would you be open to accepting a pull request that adds documentation on how to use ChainedModelChoiceForm in a form?
@alokshenoy Absolutely! 😄
tried latest version and still not fixed ,
Is there any update on this issue. or is there a correct documentation. Can you please reply @blag
@rakeshgm Sorry I have been extremely busy and haven't touched my open source projects in awhile. I don't have any update on this issue. At this point I'm simply awaiting a pull request from @alokshenoy fixing the documentation.
If you would like to assist me in debugging this, you can clone the master
branch and dig through the code to figure out why it isn't working.
Sorry I don't have a more useful update. 😕
Gimme about 2 weeks to get this done. Gotten busy with work.
after adding
<script type="text/javascript" src="{% static 'smart-selects/admin/js/chainedfk.js' %}"></script>
<script type="text/javascript" src="{% static 'smart-selects/admin/js/chainedm2m.js' %}"></script>
<script type="text/javascript" src="{% static 'smart-selects/admin/js/bindfields.js' %}"></script>
the form works. see dungu's answer
Hey @alokshenoy - have you found any time to work on this?
Any update? I've tried all the solutions suggested here but nothing has worked yet. I do not see any ajax at all
@ThomasAriano Fire up the developer tools in your web browser and check if the AJAX request is getting sent out, find what (if anything) is being returned in the response, and post it here. If the AJAX request isn't being fired, see if there are any errors or warnings in the javascript console and post them here.
@blag Any update? I've tried all the solutions suggested here but nothing has worked yet. I do not see any ajax at all. please replay soon
Is there any documentation regarding ChainedModelChoiceField struggling to find a solution
Please anyone having this issue test again with latest release and report, thanks.
Yo al dia de hoy sigo con el mismo problema :c
hey guys ,
i have problem using this with my own app forms.py . it works well in django-admin
Steps to reproduce
my code -> core/models.py
and core/forms.py :
Expected behavior
i expect this form to work just fine like admin
Actual behavior
City fields has NO option in view unless if i set
show_all
= Truehope you guys reply soon . :)