-
Notifications
You must be signed in to change notification settings - Fork 55
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
AutocompletePanel does not work if is used inside "through" model of a manytomany #32
Comments
I have kind of a hackey way of solving this issue through JavaScript if you are still struggling with this issue |
Hi @CRSpradlin |
Hey @myornet sorry for the late reply but I was able to fix my many to many autocomplete fields by query selecting all of the attribute values that held the autocomplete id changing them slightly. This code is being ran after the auto-complete fields have been inserted into the DOM (which we have an event trigger for). var Selected_AutoCompleteFieldId;
//loop through distinct ids, if more than one autocomplete widget exits with the same id, change the id
for(var i=0; i<AutoCompleteFields_IdList.length; i++){
Selected_AutoCompleteFieldId = document.querySelectorAll('[data-autocomplete-input-id='+AutoCompleteFields_IdList[i]+']');
for(var j=1; j<Selected_AutoCompleteFieldId.length; j++){
Selected_AutoCompleteFieldId[j].attributes['data-autocomplete-input-id'].value = Selected_AutoCompleteFieldId[j].attributes['data-autocomplete-input-id'].value + j;
}
} |
Example case:
The problem is that, after pressing "new" button inside book's edition interface,
AutocompletePanel
does not render anything, but no error appear in js or django console. Simply the field is gone.I've tried to use
ClusterableModel
forBookAuthor
instead ofmodels.Model
andParentalKey('Author')
instead ofmodels.ForeignKey
but it still not working, so I think that maybe it is some kind of bug.The text was updated successfully, but these errors were encountered: