How silentsokolov/django-admin-rangefilter works
Project Overview & Main Components
• Project Type: A Django app that extends the Django admin by providing custom filter builders.
• Main Components:
• The core package (“rangefilter”) which includes:
• apps.py – for Django app configuration and registration.
• filters.py – where the implementations of various filter builders (e.g., DateRangeFilterBuilder, DateTimeRangeFilterBuilder, NumericRangeFilterBuilder, DateRangeQuickSelectListFilterBuilder) reside.
• models.py – (if utilized) containing any model logic that may be part of the integration.
• Templates Directory (rangefilter/templates/rangefilter) – holds the HTML templates that render the filter UI in the Django admin; note that different templates exist (versioned by Django versions like 1.8, 4.0, etc.).
• Templatetags (rangefilter/templatetags) – contains custom template tags to integrate the filters into Django’s templating system.
• Localization (rangefilter/locale) – contains i18n files (django.po and compiled django.mo files) for multiple languages.
• Tests Directory – includes tests for migrations, settings, and functionality ensuring the filter logic performs as expected.
• Additional files such as setup.py, pyproject.toml, and the configuration files (Makefile, MANIFEST.in) support packaging and deployment via PyPI.
Mapping Interactions and Components
• Admin Interface Integration:
• Imagine the standard Django Admin interface provided by the main Django framework.
• The “rangefilter” app is added to INSTALLED_APPS so that it extends the admin UI.
• Filter Builders and Data Flow:
• Filter Builders (classes in filters.py) that handle date and numeric filtering.
• Template integration (a dedicated area connecting to the templates/ folder), showing how HTML templates get rendered in the admin UI.
• Custom Templatetags – highlighting how these components embed the functionality into Django’s admin templates.
• Localization & Internationalization:
• Testing & Continuous Integration:
• Optionally, note the existence of GitHub Actions workflows (under .github/workflows) to represent CI/CD processes ensuring quality before deployments.
• Dependency on Django:
• Additional Considerations:
• Configuration and packaging elements (like setup.py, pyproject.toml) as auxiliary blocks that feed into deployment pipelines.
• That customization (like support for django-csp for security headers via Content-Security-Policy) is built into the design.
Putting It All Together
• Branch out from “rangefilter” into its submodules: Filter Builders, Template Tags, Templates, Localization, and Tests.