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
Widgets not showing up in and out of Admin panel #699
Comments
Did you install from pypi or git ? If fit, jave you synced submodules?
|
Installed using pypi: |
Are the static resources properly loaded ?
|
That's the thing. I don't know. (Though I don't think so because the widgets don't load properly) How do I check if they are properly loaded ? |
With something like the network tab of firebug or the webkit inspector.
|
This is what I get in the network tab |
I don't see select2.js nor autocomplete.init.js, which would greatly help
:P
Could you paste your admin and form code for Actor please ?
|
Actor Form:
Admin:
The actor itself does not have a Form the Form is autogenerated by a Createview:
|
Question: why do you have autocomplete.Select instead
of autocomplete.Select2 ?
:P
|
Because it didn't show up in PyCharm's IntelliSense. I tried every widget that was there to no avail. When I try to force autocomplete.Select2 this is what I get:
|
http://django-autocomplete-light.readthedocs.io/en/master/tutorial.html#use-the-view-in-a-form-widget
Right, it should be ModelSelect2 or something, please try to follow the
tutorial.
|
I followed the tutorial that is why my code is almost completely identical to the tutorial. ModelSelect2 is what I tried at first (Because it's in the tutorial)
(I tried it again now and got the same exception) I tried it with ModelSelect2Multiple with Actor.Scenes which is a M2M field. The same result. An empty widget but this time it's just an empty M2M widget from the admin view.
autocomplete.Select is the only widget that didn't cause an exception with a charfield but like I said it's just empty, and from what you said the static files don't load correctly :( |
Well, i didn't know you wouldn't use a relation here, because I don't know your models code. I really don't get the big picture of what you're trying to do. Could you perhaps isolate the use case in test_project ? |
Tomorrow I'll try to make a new up from scratch and use the exact code that is in the tutorial. Though I don't know if it will help, it seems the problem here is that the static files are not loading, no?
What I'm trying to do is to make a local netflix-like library, and specifically with the autocomplete I want it to help the user add actors to a movie or a tv-show based on already existing actors. But right now I'm just trying to make the autocomplete work with something so I tried all the combinations of fields and wigets I can think of. Sadly it didn't help. |
IT's not loading because it's the vanilla select widget. ModelSelect2Multiple sounds like the way to go, perhaps checking this example would help ? I don't think that's right: url='videos/actor-autocomplete' Can't you use either an absolute url either a url name (prefered) ? When using autocomplete.ModelSelect2Multiple (whic his the right one in your case), could you check the network tab of the webkit inspector and see if select2's js is properly loaded ? Thanks ! |
That is a url name. It's just in the 'videos' namespace. Anyway, I started a new project from scratch and used only code from the tutorial. The same exact results. I wrote all the code here and took screenshots to show you and then I thought I try loading the site on FireFox instead of Chrome, and it F****** works! Any idea why would it work on Firefox and not Chrome ? I disabled all the adblock plugins this didn't affect anything ... |
Amazing, could you please upload your project source code somewhere please
?
Here it works on chrome:
http://dal-yourlabs.rhcloud.com/select2_outside_admin/
|
autocomplete.zip
Yes... All the live examples work on my chrome as well that is why I never thought the browser is the problem. Edit: Ok so Chrome is not the problem. I tested it with a new user in Chrome and it works on the new user profile. |
Awesome, it even worked out of the box for me on chromium and firefox ! Did you consider uploading this on a git repo ?
Same here 🎸 Should this issue be closed now ? Does it work on your project too ? Anyway, nice research and communication, welcome home 👯 |
I'm going to close it to prevent contributors from re-reading it before you're able to provide feedback, please reopen when you feel like it 🎸 |
Thanks for your help! |
Hello jpic it's a pleasure to say hello. I have been using django-autocomplete-light for a couple of years, it is an excellent implementation of the Select2 library for Dango that I have always recommended. Now I'm using django-autocomplete-light 3.3.2 in a new project with Django 2, Python 3.6 and it just does not work. The view and the url work perfectly, but when rendering the form both in the admin and outside the admin the tag does not work. This is what I have:
Thanks for your time |
I've just installed Django-Autocomplete-Light and followed the guide on their site. I've setup the autocomplete-view and it works as intended (returning a JASON of autocomplete options). I can't seem to get the widgets to show up, though. in and out of the admin panel.
Everything compiles without errors but instead the widget I get an empty drop down selection box.
Image of empty selection box in admin panel
This is my settings.py:
This is views.py:
urls.py:
url(r'^actor-autocomplete/$', views.ActorAutocomplete.as_view(), name='actor-autocomplete'),
forms.py:
It feels like I'm missing something simple, but I don't know what it is. Perhaps it can't access the static files, but adding 'dal' to installed_app in settings.py should have solved that according to the documentation. I'll appreciate any help!
I forgot to mention that Actor.name is of type CharField. Perhaps I'm not using the correct widget, but I haven't found one that is specific for CharField.
The text was updated successfully, but these errors were encountered: