Welcome to django-autocomplete-light’s documentation!¶
Features¶
This app fills all your ajax autocomplete needs:
- global navigation autocomplete like on facebook
- autocomplete widget for ModelChoiceField and ModelMultipleChoiceField
- GenericForeignKey fully supported
- django-generic-m2m support, yes that’s a generic M2M relation!
- CharField autocomplete support, comma separated values, useful for tags field,
- APIs powered autocomplete support, proposing results that are not (yet) in the database
- 0 hack required for admin integration, just use a form that uses the widget. It works exactly the same in the admin and in your pages.
- no jQuery-ui required, the autocomplete script is as simple as possible,
- optionnal autocomplete templating,
- 99% of the python logic is encapsulated in “autocomplete” classes, unlimited server side development possibilities
- 99% the javascript logic is encapsulated in an object, you can override any attribute or method, unlimited client side development possibilities
- 0 inline javascript you can load the javascript just before </body> for best page loading performance, wherever you want
- add another also available outside the admin,
- simple python, html and javascript, easy to hack, PEP8 compliant, tested
Requirements¶
- Python 2.7
- jQuery 1.7+
- Django 1.4+ (at least for autocomplete_light.forms helpers)
- django.contrib.staticfiles or you’re on your own
Resources¶
You could subscribe to the mailing list ask questions or just be informed of package updates.
Demo¶
See test_project/README
Full documentation¶
- django-autocomplete-light demo
- test_project: basic features and examples
- test_remote_project: advanced features and examples
- Quick start
- Making a global navigation autocomplete
- Integration with forms
- Templating autocompletes
- CharField autocompletes
- Add another popup outside the admin
- GenericForeignKey support
- Proposing results from a remote API
- Dependencies between autocompletes
- Django 1.3 support workarounds
When things go wrong¶
There is a convenience view to visualize the registry, login as staff, and open the autocomplete url, for example: /autocomplete_light/.
Ensure that:
- jquery is loaded,
autocomplete_light/static.html
is included once, it should loadautocomplete.js
,widget.js
andstyle.css
,- your form uses autocomplete_light widgets,
- your channels are properly defined see
/autocomplete/
if you includedautocomplete_light.urls
with prefix/autocomplete/
.
If you don’t know how to debug, you should learn to use:
- Firebug javascript debugger
- Open the script tab, select a script, click on the left of the code to place a breakpoint
- Ipdb python debugger
- Install ipdb with pip, and place in your python code: import ipdb; ipdb.set_trace()
If you are able to do that, then you are a professional, enjoy autocomplete_light !!!
If you need help, open an issue on the github issues page.
But make sure you’ve read how to report bugs effectively and how to ask smart questions.
Also, don’t hesitate to do pull requests !