Skip to content
Switch branches/tags
This branch is 423 commits ahead of sjrd:master.
Fetch upstream

Edit ForeignKey, ManyToManyField and CharField in Django Admin using jQuery UI AutoComplete.

Build Status PyPI version





pip install django-ajax-selects

Add the app:

    'ajax_select',  # <-   add the app

Include the urls in your project:

from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin
from django.conf import settings
from ajax_select import urls as ajax_select_urls


urlpatterns = [

    # place it at whatever base url you like
    url(r'^ajax_select/', include(ajax_select_urls)),

    url(r'^admin/', include(,
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

Quick Usage

Define a lookup channel:

# yourapp/
from ajax_select import register, LookupChannel
from .models import Tag

class TagsLookup(LookupChannel):

    model = Tag

    def get_query(self, q, request):
        return self.model.objects.filter(name__icontains=q).order_by('name')[:50]

    def format_item_display(self, item):
        return u"<span class='tag'>%s</span>" %

Add field to a form:

# yourapp/
from ajax_select.fields import AutoCompleteSelectMultipleField

class DocumentForm(ModelForm):

    class Meta:
        model = Document

    tags = AutoCompleteSelectMultipleField('tags')

This will now work in the Django Admin.

To use a form outside, be sure to include on the template where you place the form:

{{ }}
{{ form }}

Read the full documention here: outside of the admin

Fully customizable

  • Customize search query
  • Query other resources besides Django ORM
  • Format results with HTML
  • Customize styling
  • Customize security policy
  • Add additional custom UI alongside widget
  • Integrate with other UI elements elsewhere on the page using the javascript API
  • Works in Admin as well as in normal views

Assets included by default

  • //'
  • //
  • //


  • Django >=2.2
  • Python >=3.6


Many thanks to all contributors and pull requesters !


Dual licensed under the MIT and GPL licenses: