Closed NaturalBornCamper closed 3 years ago
I can reproduce in a strange way. (version 1.9.0) I have a channel configured in settings. (called 'foo' ). and a @register channel on the the same model with the name 'foo_bar'.
When i start up the server the channel 'foo_bar' is not found (like you describe above). Then i query 'foo', wich returns a result. After the query on channel 'foo', the channel 'foo_bar' starts to function properly.
did some more testing. I added a channel (via @register) on another model. That channel did not work before i issued a request on a (different) channel defined in settings.
May be lookup.py should be lookups.py?
May be lookup.py should be lookups.py?
In the docs it says "lookup.py" singular. I didn't try the plural form however, but I gave up since and removed that library since the dev was not answering, ended up coding my own.
I am facing the same issue, and my file is called lookups.py
. I have django 2.2
and I am using the latest version of this library.
All right I found the mistake... It is quite hard to find if you don't dig deep enough as the readme does not mention this at all !
But the answer is quite simple. Just follow the installation instructions in https://django-ajax-selects.readthedocs.io/en/latest/
You have to register ajax_select in your installed apps and register its URL...
I could certainly make sure the complete minimal install instructions are in the readme.
So was it that you didn't add it to settings installed apps?
On Wed, 18 Nov 2020, 11:00 Leogout, notifications@github.com wrote:
All right I found the mistake... It is quite hard to find if you don't dig deep enough as the readme does not mention this at all ! But the answer is quite simple. Just follow the installation instructions in https://django-ajax-selects.readthedocs.io/en/latest/ You have to register ajax_select in your installed apps and register its URL...
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/crucialfelix/django-ajax-selects/issues/279#issuecomment-729569899, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABVM4V7XX277MB5GBIE633SQOLLPANCNFSM4SVKAXKA .
Registering the library in INSTALLED_APPS
and in the url.py
. Things which are quite obvious for any django package but they flew over my head because I went too fast. I just did what the README.md told me without stopping and thinking.
Here are the relevant parts of the documentation that mentions it :
Add the app:
# settings.py
INSTALLED_APPS = (
...
'ajax_select', # <- add the app
...
)
Include the urls in your project:
# urls.py
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin
from django.conf import settings
from ajax_select import urls as ajax_select_urls
admin.autodiscover()
urlpatterns = [
# place it at whatever base url you like
url(r'^ajax_select/', include(ajax_select_urls)),
url(r'^admin/', include(admin.site.urls)),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Thanks for the clear explanation. I will put it in the readme. It should definitely be there, clear and simple
On Fri, 20 Nov 2020, 23:31 Leogout, notifications@github.com wrote:
Registering the library in INSTALLED_APPS and in the url.py. Things which are quite obvious for any django package but they flew over my head because I went too fast. I just did what the README.md told me without stopping and thinking.
Here are the relevant parts of the documentation that mentions it :
Add the app:
settings.pyINSTALLED_APPS = (
... 'ajax_select', # <- add the app ...
)
Include the urls in your project:
urls.pyfrom django.conf.urls import url, includefrom django.conf.urls.static import staticfrom django.contrib import adminfrom django.conf import settingsfrom ajax_select import urls as ajax_select_urls
admin.autodiscover() urlpatterns = [
# place it at whatever base url you like url(r'^ajax_select/', include(ajax_select_urls)), url(r'^admin/', include(admin.site.urls)),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crucialfelix/django-ajax-selects/issues/279#issuecomment-731440687, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABVM4VUOQL23XGRQ5AYX2LSQ3U2ZANCNFSM4SVKAXKA .
You're welcome, I have made a PR if you like. Have a nice day.
Closing as it sounds like the problem was found. I merged the change to the readme.
Thanks everyone
I copy-pasted the code in the docs (install section), specifically the lookup:
In myapp/lookup.py
But I'm getting:
yet in the docs, it says: "If you are using Django >= 1.7 then all lookups.py in all of your apps will be automatically imported on startup." so anyone knows what went wrong? I'm using the latest 3.1 Django and trying to show the form on a frontend page (not in the admin)
I also tried to put in my form and views:
register('countries')
register(CountryLookup)