Skip to content
Ajax autocomplete list filter for Django admin
Python JavaScript Ruby HTML CSS
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
djaa_list_filter Bump version: 0.1.2 → 0.1.3 Oct 25, 2019
screenshots Add demo animation gif Oct 19, 2019
.bumpversion.cfg Bump version: 0.1.2 → 0.1.3 Oct 25, 2019
.flake8 Add linter, checker configurations Oct 11, 2019
.gitignore POC works Oct 10, 2019
.isort.cfg Add linter, checker configurations Oct 11, 2019
.pylintrc Add WillRemoveInVersion10 warning Oct 19, 2019
LICENCE Add python package scaffold Oct 7, 2019 Fix f-string problem Oct 25, 2019
Rakefile Add python package scaffold Oct 7, 2019
pyproject.toml Bump version: 0.1.2 → 0.1.3 Oct 25, 2019

Python Python Python Django Django Code style: black PyPI version


Ajax autocomplete list filter helper for Django admin. Uses Django’s built-in autocomplete widget! No extra package or install required!


Installation and Usage

$ pip install django-admin-autocomplete-list-filter

Add djaa_list_filter to INSTALLED_APPS in your


Now, let’s look at this example model:


from django.conf import settings
from django.db import models

class Post(models.Model):
    category = models.ForeignKey(to='Category', on_delete=models.CASCADE, related_name='posts')
    author = models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='posts')
    title = models.CharField(max_length=255)
    body = models.TextField()
    tags = models.ManyToManyField(to='Tag', blank=True)

    def __str__(self):
        return self.title

class Category(models.Model):
    title = models.CharField(max_length=255)

    def __str__(self):
        return self.title

class Tag(models.Model):
    name = models.CharField(max_length=255)

    def __str__(self):

We have 2 ForeignKey fields and one ManyToManyField to enable autocomplete list filter feature on admin. All you need is to inherit from AjaxAutocompleteListFilterModelAdmin which inherits from Django’s admin.ModelAdmin.

Now we have an extra ModelAdmin method: autocomplete_list_filter. Uses Django Admin’s search_fields logic. You need to enable search_fields in the related ModelAdmin. To enable completion on Category relation, CategoryAdmin should have search_fields that’s it!

from django.contrib import admin

from djaa_list_filter.admin import (

from .models import Category, Post, Tag

class PostAdmin(AjaxAutocompleteListFilterModelAdmin):
    list_display = ('__str__', 'author', 'show_tags')
    autocomplete_list_filter = ('category', 'author', 'tags')

    def show_tags(self, obj):
        return ' , '.join(obj.tags.values_list('name', flat=True))

class CategoryAdmin(admin.ModelAdmin):
    search_fields = ['title']
    ordering = ['title']

class TagAdmin(admin.ModelAdmin):
    search_fields = ['name']
    ordering = ['name']


You are very welcome to contribute, fix bugs or improve this project. We hope to help people who needs this feature. We made this package for our company project. Good appetite for all the Django developers out there!


This project is licensed under MIT



All PR’s are welcome!

  1. fork (
  2. Create your branch (git checkout -b my-features)
  3. commit yours (git commit -am 'added killer options')
  4. push your branch (git push origin my-features)
  5. Than create a new Pull Request!


  • Add unit tests
  • Improve JavaScript code :)

Change Log


  • Remove f-string for older Python versions, will change this on 1.0.0 version


  • Bump version: 0.1.2
  • Add Python 3.5 supports, thanks to Peter Farrel
  • Add animated gif :)
  • Add future warning for f-strings


  • Add ManyToManyField support
  • Initial release


  • Init repo...
You can’t perform that action at this time.