{"version":"1.0","type":"rich","title":"Gist 641ecab96cd0c032e3e8","description":"This example demonstrates a Django middleware that automatically applies predefined filters to admin changelist views. It shows how staff users are redirected to filtered list pages based on configuration in `ADMIN_DEFAULT_CHANGELIST_FILTERS`, while avoiding redirect loops by checking the HTTP referer. The code uses Django’s `HttpResponseRedirect`, `reverse`, and `settings` API, along with Python’s `sys` module for dynamic callback loading. The middleware triggers only for admin paths and supports both static values and callback functions to determine filter defaults, as seen in the `default_filter.py` file.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-641ecab96cd0c032e3e8?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}