django-unfold-admin-list-filter-dropdown


Namedjango-unfold-admin-list-filter-dropdown JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/francoborrelli/django-unfold-admin-list-filter-dropdown
SummaryUse dropdowns in Django admin list filter
upload_time2024-04-26 14:41:37
maintainerNone
docs_urlNone
authorFranco Borrelli
requires_pythonNone
licenseMIT License
keywords django admin filter dropdown unfold django-unfold
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-unfold-admin-list-filter-dropdown

[![PyPI version](https://badge.fury.io/py/django-unfold-admin-list-filter-dropdown.svg)](https://badge.fury.io/py/django-unfold-admin-list-filter-dropdown)

> [!NOTE]  
> This version is compatible with [django-unfold](https://github.com/unfoldadmin/django-unfold).

A Django admin filter implementation that renders as a dropdown.

If you have more than ten values for a field that you want to filter by in
Django admin, the filtering sidebar gets long, cluttered and hard to use.

This app contains the `DropdownFilter` class that renders as a drop-down in the
filtering sidebar to avoid this problem.

# Usage

Install:

```sh
pip install django-unfold-admin-list-filter-dropdown
```

Enable in `settings.py`:

```py
INSTALLED_APPS = (
    ...
    'django_unfold_admin_listfilter_dropdown',
    ...
)

```

Use in `admin.py`:

```py
from django_admin_listfilter_dropdown.filters import DropdownFilter, RelatedDropdownFilter, ChoiceDropdownFilter

class EntityAdmin(admin.ModelAdmin):
    ...
    list_filter = (
        # for ordinary fields
        ('a_charfield', DropdownFilter),
        # for choice fields
        ('a_choicefield', ChoiceDropdownFilter),
        # for related fields
        ('a_foreignkey_field', RelatedDropdownFilter),
    )
```

Example of a custom filter that uses the provided template:

```py
class CustomFilter(SimpleListFilter):
    template = 'django_unfold_admin_listfilter_dropdown/dropdown_filter.html'

    def lookups(self, request, model_admin):
        ...

    def queryset(self, request, queryset):
        ...
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/francoborrelli/django-unfold-admin-list-filter-dropdown",
    "name": "django-unfold-admin-list-filter-dropdown",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "django, admin, filter, dropdown, unfold, django-unfold",
    "author": "Franco Borrelli",
    "author_email": "francoborrelli96@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/14/74/484ab12ee7aa17c81288b49ab8c420397e1a492f8ff9114e15c3689e36a5/django_unfold_admin_list_filter_dropdown-1.0.4.tar.gz",
    "platform": null,
    "description": "# django-unfold-admin-list-filter-dropdown\n\n[![PyPI version](https://badge.fury.io/py/django-unfold-admin-list-filter-dropdown.svg)](https://badge.fury.io/py/django-unfold-admin-list-filter-dropdown)\n\n> [!NOTE]  \n> This version is compatible with [django-unfold](https://github.com/unfoldadmin/django-unfold).\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-unfold-admin-list-filter-dropdown\n```\n\nEnable in `settings.py`:\n\n```py\nINSTALLED_APPS = (\n    ...\n    'django_unfold_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_unfold_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",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Use dropdowns in Django admin list filter",
    "version": "1.0.4",
    "project_urls": {
        "Download": "https://github.com/francoborrelli/django-unfold-admin-list-filter-dropdow/archive/1.0.4.zip",
        "Homepage": "https://github.com/francoborrelli/django-unfold-admin-list-filter-dropdown"
    },
    "split_keywords": [
        "django",
        " admin",
        " filter",
        " dropdown",
        " unfold",
        " django-unfold"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22de132d7cd06c7ba34861b2363d57e738d6fb624169677045061af779ab1b4d",
                "md5": "98cf1f5af41d6a969a9012b347612f28",
                "sha256": "a1cc0ccdca63302a7195f34be4a3631a8b15f28292a503544ee0596f9dc0821b"
            },
            "downloads": -1,
            "filename": "django_unfold_admin_list_filter_dropdown-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "98cf1f5af41d6a969a9012b347612f28",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4728,
            "upload_time": "2024-04-26T14:41:36",
            "upload_time_iso_8601": "2024-04-26T14:41:36.742875Z",
            "url": "https://files.pythonhosted.org/packages/22/de/132d7cd06c7ba34861b2363d57e738d6fb624169677045061af779ab1b4d/django_unfold_admin_list_filter_dropdown-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1474484ab12ee7aa17c81288b49ab8c420397e1a492f8ff9114e15c3689e36a5",
                "md5": "0c4b73e429e8d8a8dbdba65fdc3694e7",
                "sha256": "f00b7a70c31ac850195c655fc48f7b5499c838b30aae9780d4e0551c30a0a9d4"
            },
            "downloads": -1,
            "filename": "django_unfold_admin_list_filter_dropdown-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "0c4b73e429e8d8a8dbdba65fdc3694e7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3893,
            "upload_time": "2024-04-26T14:41:37",
            "upload_time_iso_8601": "2024-04-26T14:41:37.690239Z",
            "url": "https://files.pythonhosted.org/packages/14/74/484ab12ee7aa17c81288b49ab8c420397e1a492f8ff9114e15c3689e36a5/django_unfold_admin_list_filter_dropdown-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-26 14:41:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "francoborrelli",
    "github_project": "django-unfold-admin-list-filter-dropdown",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-unfold-admin-list-filter-dropdown"
}
        
Elapsed time: 0.36346s