Edit ForeignKey, ManyToManyField and CharField in Django Admin using jQuery UI AutoComplete.
Low maintenance activity. Last release over 2 years ago, commits in 1 of the last 26 weeks. Weaker on commit activity and recent releases.
Consider insteaddjango-autocomplete-lightPythie’s Index: 65845.3K downloads/moCompare →
pip install django-ajax-selectsEdit ForeignKey, ManyToManyField and CharField in Django Admin using jQuery UI AutoComplete
This Django app glues Django Admin, jQuery UI together to enable searching and managing ForeignKey and ManyToMany relationships.
At the time it was created Django did not have any way to do this, and this solution glued together some technologies of the day.
If you are building a new project then you should not use this.
Django has built in support now: https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields


Documentation
http://django-ajax-selects.readthedocs.org/en/latest/
Installation
pip install django-ajax-selects
Add the app:
# settings.py
INSTALLED_APPS = (
...
'ajax_select', # <- add the app
...
)
Include the urls in your project:
# urls.py
from django.urls import path
from django.conf.urls import 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
admin.autodiscover()
urlpatterns = [
# This is the api endpoint that django-ajax-selects will call
# to lookup your model ids by name
path("admin/lookups/", include(ajax_select_urls)),
path("admin/", admin.site.urls),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Quick Usage
Define a lookup channel:
# yourapp/lookups.py
from ajax_select import register, LookupChannel
from .models import Tag
@register('tags')
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>" % item.name