{"id":18444642,"url":"https://github.com/mrts/django-admin-list-filter-dropdown","last_synced_at":"2025-05-16T08:04:19.965Z","repository":{"id":57418805,"uuid":"68815435","full_name":"mrts/django-admin-list-filter-dropdown","owner":"mrts","description":"Use dropdowns in Django admin list filter","archived":false,"fork":false,"pushed_at":"2024-04-25T16:50:59.000Z","size":21,"stargazers_count":318,"open_issues_count":5,"forks_count":47,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-11T22:40:51.596Z","etag":null,"topics":["django","django-admin","filter-dropdown","node"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-21T12:39:36.000Z","updated_at":"2025-05-07T00:26:48.000Z","dependencies_parsed_at":"2024-06-18T15:24:12.471Z","dependency_job_id":"b921d483-a77d-4247-bf4e-17d374a80789","html_url":"https://github.com/mrts/django-admin-list-filter-dropdown","commit_stats":{"total_commits":15,"total_committers":9,"mean_commits":"1.6666666666666667","dds":0.7333333333333334,"last_synced_commit":"8ab1575dcd3cb9b28a80cc07695cec65fa85dfad"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fdjango-admin-list-filter-dropdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fdjango-admin-list-filter-dropdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fdjango-admin-list-filter-dropdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fdjango-admin-list-filter-dropdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrts","download_url":"https://codeload.github.com/mrts/django-admin-list-filter-dropdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493379,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-admin","filter-dropdown","node"],"created_at":"2024-11-06T07:03:04.379Z","updated_at":"2025-05-16T08:04:14.951Z","avatar_url":"https://github.com/mrts.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-admin-list-filter-dropdown\n\nA Django admin filter implementation that renders as a dropdown.\n\nIf you have more than ten values for a field that you want to filter by in\nDjango admin, the filtering sidebar gets long, cluttered and hard to use.\n\nThis app contains the `DropdownFilter` class that renders as a drop-down in the\nfiltering sidebar to avoid this problem.\n\n# Usage\n\nInstall:\n\n```sh\npip install django-admin-list-filter-dropdown\n```\n\nEnable in `settings.py`:\n\n```py\nINSTALLED_APPS = (\n    ...\n    'django_admin_listfilter_dropdown',\n    ...\n)\n\n```\n\nUse in `admin.py`:\n\n```py\nfrom django_admin_listfilter_dropdown.filters import DropdownFilter, RelatedDropdownFilter, ChoiceDropdownFilter\n\nclass EntityAdmin(admin.ModelAdmin):\n    ...\n    list_filter = (\n        # for ordinary fields\n        ('a_charfield', DropdownFilter),\n        # for choice fields\n        ('a_choicefield', ChoiceDropdownFilter),\n        # for related fields\n        ('a_foreignkey_field', RelatedDropdownFilter),\n    )\n```\n\nExample of a custom filter that uses the provided template:\n\n```py\nclass CustomFilter(SimpleListFilter):\n    template = 'django_admin_listfilter_dropdown/dropdown_filter.html'\n\n    def lookups(self, request, model_admin):\n        ...\n\n    def queryset(self, request, queryset):\n        ...\n```\n\n# Example\n\nHere's what it looks like:\n\n![Screenshot of dropdown admin filter](https://raw.githubusercontent.com/mrts/django-admin-list-filter-dropdown/master/docs/list-filter-dropdown.png)\n\n# Credits\n\nBased on [this StackOverflow question](http://stackoverflow.com/a/20900314/258772) and\n[code from FeinCMS](https://github.com/feincms/feincms/blob/master/feincms/templates/admin/filter.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrts%2Fdjango-admin-list-filter-dropdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrts%2Fdjango-admin-list-filter-dropdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrts%2Fdjango-admin-list-filter-dropdown/lists"}