Source

django-autocomplete /

Filename Size Date modified Message
autocomplete
tests/test_project
67 B
Switched to tox for running tests.
137 B
Added tag 1.0a for changeset 6c14e4ac0c80
1.0 KB
Django Autocomplete rewritten from the ground up.
264 B
Added setup.py and some tests.
1.3 KB
Default autocomplete view renamed "autocomplete". Forcing explict imports.
1.9 KB
Switched to tox for running tests.
169 B
Switched to tox for running tests.

Features

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

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 = '/path/to/autocomplete/media/'

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)