Home

Django Autocomplete has been rewritten.

The old code is still available in the 0.X branch (Usage Example for 0.X).

Django Autocomplete 1.0a

Django Autocomplete 1.0a is a complete rewrite of Django Autocomplete.

It's not really stable yet, and some things could change!

Compared to django-autocomplete it has a better support for jQuery UI Autocomplete, it has a smarter Admin integration, and has a new MultipleAutocompleteWidget for ManyToMany fields. However support for YUI has currently been dropped (I hope to re-add it soon).

Features

  • Uses jQuery UI Autocomplete.
  • ForeignKey and ManyToManyField completition.
  • Completition for CharField, IntegerField and hopefully any Field.
  • Easy Admin integration.

Documentation

Usage Example

Make the files under autocomplete/media accessible from settings.AUTOCOMPLETE_MEDIA_PREFIX (You can accomplish this by either linking or copying autocomplete/media in your project's media dir):

AUTOCOMPLETE_MEDIA_PREFIX = '/mysite/media/autocomplete/'
# Remember to include the trailing slash!

Include the view in your project's URLConf:

from autocomplete.views import autocomplete
    
url('^autocomplete/', include(autocomplete.urls))

Register a couple of AutocompleteSettings objects and start using them (for example in admin.py):

from django.contrib import admin
from django.contrib.auth.models import Message
    
from autocomplete.views import autocomplete, AutocompleteSettings
from autocomplete.admin import AutocompleteAdmin
    
class UserAutocomplete(AutocompleteSettings):
    search_fields = ('^username', '^email')
    
autocomplete.register(Message.user, UserAutocomplete)
    
class MessageAdmin(AutocompleteAdmin, admin.ModelAdmin):
    pass
    
admin.site.register(Message, MessageAdmin)

Updated

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.