whatisgithub

What is django-filter?

carltongibson/django-filter — explained in plain English

Analysis updated 2026-06-26

4,676PythonAudience · developerComplexity · 2/5Setup · easy

In one sentence

A Python library that adds user-driven filtering to Django database queries with a few lines of configuration, so visitors can filter a product list by price or category without you writing the query logic manually.

Mindmap

mindmap
  root((django-filter))
    What it does
      URL param filtering
      QuerySet narrowing
      Declarative config
    How it works
      FilterSet class
      Field declarations
      Request params
    Integrations
      Django views
      REST Framework
      Generic views
    Maintenance
      Calendar versioning
      Long-term support
      Two-year notice policy
    Audience
      Django developers
      API developers
      Backend teams
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add filter controls to a Django product listing page so users can narrow results by price, category, or any model field without writing custom query logic.

USE CASE 2

Let API clients filter query results by field values in a Django REST Framework endpoint using the same declarative FilterSet approach.

USE CASE 3

Build a searchable admin-style interface where non-technical users can slice through a database table using URL parameters.

What is it built with?

PythonDjangoDjango REST Framework

How does it compare?

carltongibson/django-filterhzy46/deep-learning-21-exampleshhatto/autopep8
Stars4,6764,6744,668
LanguagePythonPythonPython
Setup difficultyeasyhardeasy
Complexity2/53/52/5
Audiencedeveloperresearcherdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires an existing Django project, Django REST Framework integration needs that package installed separately.

No license terms are stated in the explanation.

So what is it?

Django Filter is a library for Python web applications built with Django. Its core job is letting developers add user-driven filtering to database queries without writing repetitive code from scratch. When someone visits a product listing page and wants to see only items under a certain price, or made by a specific manufacturer, Django Filter handles translating those URL parameters into database queries automatically. The library follows a pattern very similar to how Django handles forms. You declare a FilterSet class, point it at a data model, list the fields you want to be filterable, and the library takes care of the rest. The README shows a short example: a product catalog with name, price, and manufacturer fields can be made filterable with about five lines of configuration. Then in a view, you pass the incoming request parameters and your queryset together, and the library returns only the matching records. Django Filter also integrates with Django REST Framework, a popular toolkit for building web APIs. API developers can use the same declarative approach to let clients filter query results by field values, keeping the API and the regular web interface consistent in how filtering behaves. The project is mature and well-maintained. It uses calendar-based version numbers, such as 21.1 for the first release of 2021, and it tracks supported versions of Python and Django actively, dropping support for older versions when they reach their official end-of-life dates. Breaking changes are rare, and when they do happen, the maintainer aims to provide roughly two years of advance notice. Documentation is hosted on Read the Docs. For questions, there is a GitHub Discussions forum. Commercial support is available directly from the maintainer.

Copy-paste prompts

Prompt 1
I have a Django Product model with name, price, and category fields. Show me the complete FilterSet class and view code to make the listing page filterable by all three fields.
Prompt 2
How do I integrate django-filter with Django REST Framework so my API endpoint accepts query parameters like ?price_max=50 and returns only matching products?
Prompt 3
I want to add a custom filter to my django-filter FilterSet that does a case-insensitive substring match on a text field. Show me exactly how to define it.
Prompt 4
My django-filter FilterSet is filtering correctly but the form is ugly. How do I render the filter form with custom Bootstrap 5 classes in my Django template?
Prompt 5
Explain the difference between using django-filter's FilterSet directly in a view versus using the DjangoFilterBackend in a Django REST Framework ViewSet.

Frequently asked questions

What is django-filter?

A Python library that adds user-driven filtering to Django database queries with a few lines of configuration, so visitors can filter a product list by price or category without you writing the query logic manually.

What language is django-filter written in?

Mainly Python. The stack also includes Python, Django, Django REST Framework.

What license does django-filter use?

No license terms are stated in the explanation.

How hard is django-filter to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is django-filter for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.