gnotaras/django-taggit-autocomplete-modified — pull request #6 by blag (2014-04-27 03:43:07+00:00)
Title: Move autocomplete Javascript into its own file

Many sites, for performance reasons, include jQuery and other Javascript at the bottom of the page to reduce loading and client-side rendering times.

Including Javascript where the widget is rendered requires that jQuery be included before the widget (eg: at the top of the page), breaking this convention and slowing down page loads.

This PR refactors the widget's Javascript into its own file, and adds it to the Media class of the widget. This gives users the freedom to include the {{ form.media }} wherever they choose in their templates. Instead of relying on the DOM id of the tags field, the Javascript file selects tags with an "autocomplete" class, and reads the custom attribute "autocomplete-url" for the autocomplete URL of each rendered widget. Lastly, if a trailing slash is not appended to TAGGIT_AUTOCOMPLETE_MEDIA_URL, one is automatically appended before concatenating filenames onto it.

I also bumped the version number, corrected the documentation to use "TAGGIT_AUTOCOMPLETE_MEDIA_URL" instead of "DEFAULT_TAGGIT_AUTOCOMPLETE_MEDIA_URL", and documented the new jQuery requirement.

Questions, comments, and suggestions are welcome.