-
Notifications
You must be signed in to change notification settings - Fork 174
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
Added setting to allow response methods to be any module, not just ajax.py #53
base: master
Are you sure you want to change the base?
Conversation
I'm not a developer of dajaxice, and can't accept/merge anything here - but I'm having the same trouble at the moment. It's limiting to be forced to use 'app'/ajax.py. But I don't like the idea of an additional setting either, this would be equally limiting for me. Perhaps your functionality is possible without an additional setting? You would have to change dajaxice_register decorator, get out where the function you are decorating is located (relative to project root), and use this information later on, instead of your new settings entry. |
Update to present and also update an import (to enable use for Django 1.6).
Additional Django 1.6 tweaks (update simplejson to json)
`mimetype` keyword was removed from HttpResponse in Django 1.7; `content_type` should be used (see https://docs.djangoproject.com/en/1.7/internals/deprecation/#deprecation-removed-in-1-7)
Make compatible with Django 1.7+
Add missing django import
…f-django-utils-importlib-in-dajaxice Fix use of django utils importlib in dajaxice
…ice-problems-with-django-1-9 Remove deprecated in Django 1.9 url from future, use build-in url
…ice-problems-with-django-1-9 Fix all things for upgrade to the Django 1.9 version
Added a setting DAJAXICE_IMPLICIT_MODULE_NAME which lets you choose what (if any) implicit Python module name will be added to calls to response methods via Dajaxice. Specifically, if DAJAX_IMPLICIT_MODULE_NAME is implicit_module, a Javascript call to Dajaxice.app_name.method_name will cause Dajaxince to send the request to app_name.implicit_module.method_name
In other words, with this setting you can put response methods in any module, not just in ajax.py.
By default, this setting is "ajax" -- which leaves the existing functionality unchanged, i.e. response methods go in ajax.py files within app packages. Note this setting can be a blank string, which allows the Javascript Dajaxice call to mirror the Python package/module/method path more closely.
Also note that you should still always register Dajaxice response methods in a Django app's ajax.py module (even if the response methods themselves are not in that module). This is because Dajaxice's autodiscover mechanism will always look the ajax.py moduleregardless of this setting.