Open-source project
yourlabs/django-autocomplete-light avatar
yourlabs/django-autocomplete-light

django-autocomplete-light for Django Forms and Querysets

A fresh approach to autocomplete implementations, specially for Django.

1,868 stars460 forksPythonMIT

At a glance

What is it?
django-autocomplete-light adds autocomplete controls to Django choices, model relations, dependent fields, and generic foreign keys. The repository documents `dal_alight` and `dal_select2` widgets for Django 5.2 and newer, with a version compatibility matrix that matters during upgrades.
Who is it for?
Adopt django-autocomplete-light when an existing Django application needs autocomplete for choices, model relations, dependent fields, or generic foreign keys. Do not adopt it before confirming the version series against the application's Django release and checking the widget media integration.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 45 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Why Django applications need this package

django-autocomplete-light is for Django forms that collect selections from values too numerous or too dependent to present as a simple static list. The repository identifies support for multiple choice fields, multiple model choice fields, and generic foreign keys through `django-querysetsequence`. It also covers choices that do not yet exist in the autocomplete and choices that depend on other fields in the form. These are application problems rather than generic search-box problems. A Django form still needs to validate the submitted value and persist it through the relevant model field, while the interface helps the user find that value. The package therefore sits between Django's form and field machinery and the browser control used to enter data. It is a reasonable candidate for applications such as administrative forms, relation editors, tag or category selectors, and forms whose options change from one record to another. The README does not claim support for arbitrary JavaScript frontends, and it does not describe a separate server API in this section.

The `dal_alight` and `dal_select2` integration

The repository documents two widget paths. `dal_alight` is described as a native web component, while `dal_select2` uses `select2.js`. This gives an application a choice between a component-based widget and the established `select2.js` interface. The choice affects the frontend assets that a Django project must load and the behavior a developer should verify in the browser. The README also calls out dynamic widget creation, including inlines, and says that custom scripts can be supported. Dynamic creation matters because a form generated from a Django inline or another dynamic form structure may add controls after the initial page load. The package also provides a test API for custom autocomplete use cases, according to the README, and documents automatically tested examples under `test_project`. Those examples are more useful than a generic feature description because they are the repository's stated reference for supported use cases. The documentation excerpt does not specify the exact JavaScript initialization API or endpoint response format, so an implementation should use the documented widget-specific instructions rather than infer those details.

Version compatibility and upgrade boundaries

The current project metadata requires Python `>=3.11` and Django `>=5.2`. The README presents a compatibility matrix rather than suggesting that every historical release works with every current Django version. It lists the 5.x series for Django 5.2 and 6.0+, associated with WebComponent support and an upgrade path from version 4. The 4.x series is listed for Django 4.2, 5.2, and 6.0+, with a stated purpose of modernization and cleanup. It also lists a 3.12.x series for Django 3.2 through 5.2. That matrix is a key adoption constraint. An application should select the django-autocomplete-light series first, then check whether its own Python and Django versions are accepted. The repository contains separate upgrade documentation for transitions from version 3 to 4 and from version 4 to 5. The README also records that version 4.0.1 introduced breaking changes from 4.0 and was re-released as 5.0. That is a direct warning against treating minor package upgrades as routine in this project. Upgrade planning needs to include widget media changes, field declarations, and any integration code that depends on older package behavior.

Installation and a first project inspection

The README directs users to the hosted documentation and PyPI for installation instructions, but it does not include a concrete installation command. The package metadata confirms the distribution name and its core dependencies, while the optional dependency list identifies extras for nested administration, tags, and generic foreign keys. Start by opening the documentation named in the README, select the version series that matches the application's Django release, and inspect the corresponding `test_project` example. The project also contains `pyproject.toml`, `package.json`, `src`, `docs`, and `test_project`. Those files indicate that the Python package, frontend assets, documentation, and examples are separate parts of the repository. A first review should compare the selected example's form and template with the current application rather than copying an example from another Django version. The README does not specify a universal `manage.py` command for checking installation.

Media loading on Django 5.2 and newer

The README calls out a specific frontend detail for newer Django versions. It says that `dal_alight` widget media uses scripts with `type="module"` on Django 5.2+, through `django.forms.widgets.Script` or a small backport in `dal_alight.media`. The stated reason is that merged form media should not execute web component registration twice. This is relevant for applications that combine form media, custom templates, and several widgets in one page. A duplicated registration can affect the browser's behavior even when the server-side form is otherwise correct, so media loading deserves an explicit review. The repository's `pyproject.toml` declares Django `>=5.2`, and its compatibility matrix includes Django 5.2 and 6.0+, so this behavior is part of the documented current setup rather than an optional enhancement. Teams using an older Django release need to consult the matrix and version-specific documentation. The README does not provide a complete static-file configuration example, so it would be incorrect to claim that adding one specific path is sufficient for every deployment.

When the package is the wrong choice

django-autocomplete-light is not the right abstraction when the required interface is not a Django form control. A standalone search page, a non-Django API, or a custom frontend with no Django form integration would need a different implementation. The documented feature set is centered on forms, widgets, model choices, generic foreign keys, and inlines. Another limitation is version sensitivity. The package metadata and README target modern Python and Django releases, but the repository also contains historical series and explicit breaking-change warnings. An application pinned to an older Django version may need to remain on an older package line, which changes its upgrade path. The feature list also does not promise a particular backend search algorithm, indexing system, ranking policy, or performance profile. It should not be selected on the assumption that it solves a database query bottleneck. Applications that require strict response-time targets should review their queryset, model indexes, and request pattern separately. The documentation excerpt does not state whether an autocomplete endpoint has pagination, caching, or rate limiting, so those properties should not be assumed.

How it compares with a custom autocomplete layer

The main alternative is a custom combination of Django form field logic, a hand-written endpoint, and a browser widget such as `select2.js`. That approach gives an application full control over transport, rendering, caching, and frontend lifecycle, but it also requires the developer to build and maintain the glue between the form and the control. django-autocomplete-light packages that integration for common Django field types and provides widget choices including `dal_select2`. Its dependency on Django forms is an advantage when the existing application already has forms and queryset-backed choices. It is a liability when the selection interface must work outside Django's form lifecycle or when the frontend has requirements that the documented widgets do not cover. The repository also provides examples and a test API, which can reduce the amount of custom integration code for supported cases. Those examples do not prove that every custom requirement is supported. A team should compare the field types, dynamic form behavior, media loading, and upgrade documentation against the requirements of its own frontend.

Maintenance, licensing, and adoption cost

The repository is not archived, and its last push was on 2026-09-09, so it is not correct to treat it as archived. The available release history lists version 2.2.0 on 2015-06-02, while the repository metadata describes newer compatibility series and says Python 3.11 through 3.14 and Django 5.2 through 6.0+ are supported. This mismatch means release metadata should be checked against the package actually installed rather than inferred from the old release list. The repository contains `CHANGELOG`, `CHANGES.txt`, upgrade documentation, and automated test-related files, but the excerpt does not state a support window for each series. The package is licensed under MIT, as declared in both the repository metadata and `pyproject.toml`. That identifies the license, but it is not a substitute for reviewing the actual `LICENSE` file and any obligations that apply to bundled frontend assets. Upgrade cost is likely concentrated in version-series changes, widget media, form declarations, and custom scripts. The README's breaking-change warning makes those areas the appropriate focus for an adoption review.

Practical adoption criteria

The strongest adoption case is an existing Django form whose choices are expensive to scan, relational, dependent, or created dynamically. The package is particularly relevant when the application accepts multiple selections or needs generic foreign key input and is willing to use a documented widget. The first check should be the compatibility matrix, because the project distinguishes version series and documents major upgrade paths. The second check is whether the application's forms use the field types covered by the README, including model choices and generic foreign keys. The third check is frontend media: confirm that `dal_alight` module scripts or the selected `dal_select2` assets are loaded through the project's normal Django media path without duplicate registration. Finally, review the `test_project` examples and the changelog for the installed series. If the application needs undocumented search behavior, an independent frontend architecture, or a Django version outside the selected matrix, a custom implementation may be a clearer boundary than adopting this package.

Editorial conclusion

Adopt django-autocomplete-light when an existing Django application needs autocomplete for choices, model relations, dependent fields, or generic foreign keys. Do not adopt it before confirming the version series against the application's Django release and checking the widget media integration. The first project-specific checks are the compatibility matrix, the form field configuration, and the `dal_alight` module script behavior described in the README.

Frequently asked questions

Which Django versions does django-autocomplete-light support?

The current `pyproject.toml` requires `django>=5.2` and supports Python 3.11 through 3.14. The README compatibility matrix also distinguishes older django-autocomplete-light series, so the package series should be matched to the Django version.

Which autocomplete widgets does django-autocomplete-light provide?

The README lists the native `dal_alight` web component and `dal_select2`, which uses `select2.js`. It also documents dynamic widget creation for cases such as inlines.

Does django-autocomplete-light support generic foreign keys and dependent form choices?

The README states that generic foreign keys are supported through `django-querysetsequence` and that choices can depend on other fields in the form. The package metadata lists `django-querysetsequence>=0.11` under the `gfk` optional dependency.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. yourlabs/django-autocomplete-light on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/yourlabs-django-autocomplete-light.svg)](https://hysenlabs.com/projects/yourlabs-django-autocomplete-light)

Was this useful?