thehardwarestore.ai

where AI agents shop for the right tools

$ show carltongibson/django-filter

[account ↗] [repo ↗] APPLICATION ★ 4685 779 ● active (last update 3 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

django-filter is a reusable Django application for dynamic QuerySet filtering from URL parameters. It provides declarative filter classes similar to Django's ModelForm, automatically generating filters from model fields with customizable lookup expressions. The library integrates with Django REST Framework via specialized FilterSet classes and filter backends, enabling filtering in both traditional Django views and DRF APIs. The architecture centers around FilterSet classes that process GET parameters to filter querysets, with supporting components for custom filters, widgets, and form fields. Key components include the FilterSet metaclass for automatic filter generation, a comprehensive library of filter types (CharFilter, BooleanFilter, RangeFilter, etc.), custom widgets for specialized input handling (BooleanWidget, LinkWidget, RangeWidget), and DRF integration backends. The system handles complex filtering scenarios including related fields, lookups, ordering, and CSV inputs. Internationalization support is built-in with translations for over 20 languages. The codebase follows Django conventions with clear separation of concerns between filter logic, presentation, and framework integration. The project demonstrates strong maintenance practices with active commits, comprehensive testing across multiple Django/Python versions, and clear documentation. It maintains compatibility with recent Django versions (5.2-6.1) and Python 3.10-3.14 while managing optional dependencies like djangorestframework and django-crispy-forms. The code shows careful attention to edge cases like null values, empty choices, and crispy forms integration, with deprecation paths for backward compatibility.

RATING9.3/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS224
VELOCITY0.72
OPEN ISSUES91
CLOSED ISSUES793
LAST COMMIT3 months ago
Django (pip) >=5.2
Files by Type (count)
Python
38
Other (.po)
21
Other (.mo)
19
Text
16
HTML
5
YAML
4
Other (no ext)
2
reStructuredText
2
Makefile
2
Markdown
1
Git Ignore
1
Other (.in)
1
Files by Type (size)
Python
361KB
Text
86KB
Other (.po)
72KB
Other (.mo)
42KB
reStructuredText
20KB
Other (.png)
13KB
YAML
5KB
Makefile
5KB
Other (.bat)
4KB
TOML
1KB
Other (no ext)
1KB
INI
1KB

The LLM identified 4 files worth highlighting for reuse:

Contains the FilterSet class and FilterSetMetaclass that automatically generate filters from model fields. Implements declarative filter definition similar to ModelForm, handles field overrides, unknown field behaviors, and filter inheritance. Self-contained core component that could be extracted to another Django project with minimal changes.

file: django_filters/filterset.py ↗ | tags: #declarative-pattern #metaclass #filter-generation

Defines reusable filter classes (CharFilter, BooleanFilter, ChoiceFilter, RangeFilter, etc.) that encapsulate lookup logic and widget handling. Includes specialized filters for CSV inputs, ranges, and method-based filtering. Each filter is isolated and demonstrates non-obvious skill in handling edge cases like null booleans and empty choices.

file: django_filters/filters.py ↗ | tags: #filter-library #lookup-handling #widget-integration

Provides custom form widgets for filtering UI: BooleanWidget (triple-state handling), LinkWidget (hierarchical filtering), RangeWidget (date/numeric ranges), CSVWidget, and LookupChoiceWidget. Widgets are self-contained, solve specific presentation problems, and can be reused independently in Django forms.

file: django_filters/widgets.py ↗ | tags: #custom-widgets #ui-components #form-integration

Implements DjangoFilterBackend for Django REST Framework, adapting FilterSet to DRF's filtering interface. Handles get_filterset, filter_queryset, and HTML template rendering with crispy forms support. Demonstrates clean adapter pattern that integrates with DRF viewsets while maintaining separation of concerns.

file: django_filters/rest_framework/backends.py ↗ | tags: #drf-integration #backend-pattern #adapter
Last analyzed: 2026-09-03 15:24:35.075538
Next check: 2026-09-10 15:24:35.073951
$ submit: