Skip to main content

Django admin autocomplete with related field support

Project description

Django-search-admin-autocomplete

https://raw.githubusercontent.com/linevych/django-search-admin-autocomplete/master/doc/demo.gif

This is a fork of django-search-admin-autocomplete (archived). The original package is no longer maintained. This fork adds new features, modern Django support, and bug fixes.

Simple Django app that adds autocomplete search to the admin panel changelist view.

What’s New

  • Related field search: Search across ForeignKey relations (e.g., client__name, category__title)

  • Django 4+ / 5+ support: Fixed deprecated url() imports

  • Modern build system: pyproject.toml with hatchling (no more setup.py)

  • Python 3.8–3.13 support

  • Comprehensive test suite (18 tests)

Requirements

  • Python: 3.8+

  • Django: 3.2+

Installation

pip install django-listview-search-admin-autocomplete
INSTALLED_APPS = [
    ...
    'search_admin_autocomplete',
    ...
]

Usage

Basic usage with direct fields:

from search_admin_autocomplete.admin import SearchAutoCompleteAdmin

class MyModelAdmin(SearchAutoCompleteAdmin):
    search_fields = ['name', 'description']

admin.site.register(MyModel, MyModelAdmin)

Configuration Options

class MyModelAdmin(SearchAutoCompleteAdmin):
    search_fields = ['name', 'client__name']
    search_prefix = '__icontains'  # Search operator (default: '__contains')
    max_results = 20               # Max autocomplete results (default: 10)

Customization

If you have a custom change_list.html:

admin.py

from search_admin_autocomplete.admin import SearchAutoCompleteAdmin

class MyModelAdmin(SearchAutoCompleteAdmin):
    change_list_template = 'admin/custom-list.html'
    search_fields = ['name', 'client__title']

admin.site.register(MyModel, MyModelAdmin)

admin/custom-list.html

{% extends 'search_admin_autocomplete/change_list.html' %}

{% block object-tools %}
Your custom html...
{{ block.super }}
{% endblock %}

Running Tests

cd example
python manage.py test search_admin_autocomplete

Changelog

0.3.0 (2026)

  • Forked from archived django-search-admin-autocomplete

  • Added support for related field lookups (e.g., client__name)

  • Updated for Django 4+ and 5+ compatibility

  • Modernized package configuration with pyproject.toml

  • Added comprehensive test suite (18 tests)

0.2.1 and earlier

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file django_listview_search_admin_autocomplete-0.3.0.tar.gz.

File metadata

File hashes

Hashes for django_listview_search_admin_autocomplete-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3d954a698f1f4c0ef6e5cb67095bfb1fce8a955ccc2a17509c4ced37e98533df
MD5 e2ea7a27a7c7248b01717e641d76b6b3
BLAKE2b-256 2eb8c94032d5497f3b9f959bbb8618fd74e1e2a2228d1e65404f4ae53e6f26ca

See more details on using hashes here.

File details

Details for the file django_listview_search_admin_autocomplete-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_listview_search_admin_autocomplete-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37abcb836a0a5f2b4cdc6ead5be897e4189618dee839defa801eeba362642e59
MD5 afce0b182dea6ef5119b854e7c575d0d
BLAKE2b-256 a3dcb15abdb202b396f79f4b6004fad96610840f0b7ae092e71210349c626375

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page