{"id":5610,"library":"django-admin-list-filter-dropdown","title":"Django Admin List Filter Dropdown","description":"django-admin-list-filter-dropdown is a Python library that enhances the Django administration interface by converting default list filters into dropdowns. This improves usability and reduces clutter in the sidebar, especially when a filter has numerous options. The current version is 1.0.3, released in 2019, suggesting a stable but less actively maintained project.","status":"maintenance","version":"1.0.3","language":"en","source_language":"en","source_url":"https://github.com/mrts/django-admin-list-filter-dropdown","tags":["django","admin","filter","dropdown","ui","ux","list_filter"],"install":[{"cmd":"pip install django-admin-list-filter-dropdown","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Core framework dependency; integrates with Django's admin interface.","package":"Django","optional":false}],"imports":[{"note":"The package name in INSTALLED_APPS and import path uses underscores, not hyphens.","wrong":"from admin_list_filter_dropdown.filters import DropdownFilter","symbol":"DropdownFilter","correct":"from django_admin_listfilter_dropdown.filters import DropdownFilter"},{"note":"Used for fields with predefined choices.","symbol":"ChoiceDropdownFilter","correct":"from django_admin_listfilter_dropdown.filters import ChoiceDropdownFilter"},{"note":"Used for foreign key or many-to-many related fields.","symbol":"RelatedDropdownFilter","correct":"from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter"}],"quickstart":{"code":"# settings.py\nINSTALLED_APPS = [\n    # ... other apps\n    'django_admin_listfilter_dropdown',\n    # ...\n]\n\n# admin.py\nfrom django.contrib import admin\nfrom django.db import models # For example model\nfrom django_admin_listfilter_dropdown.filters import DropdownFilter, ChoiceDropdownFilter, RelatedDropdownFilter\n\n\n# Example Models\nclass Category(models.Model):\n    name = models.CharField(max_length=100)\n\n    def __str__(self):\n        return self.name\n\nclass Product(models.Model):\n    STATUS_CHOICES = [\n        ('in_stock', 'In Stock'),\n        ('out_of_stock', 'Out of Stock'),\n        ('coming_soon', 'Coming Soon'),\n    ]\n    name = models.CharField(max_length=100)\n    status = models.CharField(max_length=20, choices=STATUS_CHOICES)\n    category = models.ForeignKey(Category, on_delete=models.CASCADE)\n    is_active = models.BooleanField(default=True)\n\n    def __str__(self):\n        return self.name\n\n\n@admin.register(Product)\nclass ProductAdmin(admin.ModelAdmin):\n    list_display = ('name', 'status', 'category', 'is_active')\n    list_filter = (\n        ('status', ChoiceDropdownFilter), # For fields with choices\n        ('category', RelatedDropdownFilter), # For foreign key fields\n        ('is_active', DropdownFilter), # For boolean fields, or custom SimpleListFilter\n    )\n\n@admin.register(Category)\nclass CategoryAdmin(admin.ModelAdmin):\n    list_display = ('name',)\n","lang":"python","description":"First, add `django_admin_listfilter_dropdown` to your `INSTALLED_APPS`. Then, in your `admin.py`, import the desired filter classes (e.g., `DropdownFilter`, `ChoiceDropdownFilter`, `RelatedDropdownFilter`) and use them within the `list_filter` tuple of your `ModelAdmin` class. This example demonstrates how to apply dropdown filters to a choice field, a foreign key field, and a boolean field."},"warnings":[{"fix":"Thoroughly test on your target Django version. If issues arise, investigate the Django admin templates for breaking changes that might affect the custom filter rendering. Forks or alternative packages (like django-unfold-admin-list-filter-dropdown) might offer better compatibility with newer Django admin themes.","message":"The library has not seen a new release since October 2019. While it generally works with modern Django versions, explicit compatibility with Django 4.x or 5.x is not guaranteed and may require manual testing or minor template adjustments. Consider testing thoroughly on newer Django projects.","severity":"gotcha","affected_versions":"Django >= 3.0"},{"fix":"This is intended behavior to avoid unnecessary dropdowns. If you strictly require a dropdown for fewer options, you might need to override the filter's `template` attribute with a custom template that forces dropdown rendering, or extend the filter logic.","message":"The dropdown filters typically only render as a dropdown if there are a sufficient number of distinct options (e.g., more than 2 or 3). If fewer options exist, Django's default list filter rendering (as a simple list) will likely be used instead.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For searchable dropdowns, consider integrating with another library like `django-admin-autocomplete-list-filter` (though deprecated, it shows the concept), or `django-admin-searchable-dropdown`, or implement custom JavaScript/Ajax for autocomplete functionality within your Django admin.","message":"This library does not natively provide search/autocomplete functionality within the dropdowns. For filtering very large datasets, users might find it cumbersome to scroll through a long list.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always ensure `INSTALLED_APPS` includes `'django_admin_listfilter_dropdown'`.","message":"Forgetting to add `'django_admin_listfilter_dropdown'` to your `INSTALLED_APPS` in `settings.py` is a common mistake that will prevent the custom dropdown filters from being recognized and applied in the Django admin.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}