{"id":13415922,"url":"https://github.com/shinneider/django-admin-search","last_synced_at":"2025-12-25T04:28:18.347Z","repository":{"id":49932825,"uuid":"144150278","full_name":"shinneider/django-admin-search","owner":"shinneider","description":"Modal filter for django admin","archived":false,"fork":false,"pushed_at":"2024-09-03T21:39:34.000Z","size":247,"stargazers_count":78,"open_issues_count":7,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-07T17:10:09.055Z","etag":null,"topics":["django","django-admin","filter","filters","modal","search"],"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/shinneider.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":"2018-08-09T12:34:26.000Z","updated_at":"2024-09-30T18:11:36.000Z","dependencies_parsed_at":"2024-01-11T19:15:37.131Z","dependency_job_id":"87b3d985-25af-41b0-a368-73e6acfa3221","html_url":"https://github.com/shinneider/django-admin-search","commit_stats":{"total_commits":119,"total_committers":9,"mean_commits":"13.222222222222221","dds":"0.31932773109243695","last_synced_commit":"f4ca88dbafc53630f38c65255bdb1a8d073ad4a4"},"previous_names":["shinneider/django_admin_search"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinneider%2Fdjango-admin-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinneider%2Fdjango-admin-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinneider%2Fdjango-admin-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinneider%2Fdjango-admin-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinneider","download_url":"https://codeload.github.com/shinneider/django-admin-search/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243663459,"owners_count":20327299,"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","filters","modal","search"],"created_at":"2024-07-30T21:00:53.056Z","updated_at":"2025-12-25T04:28:18.340Z","avatar_url":"https://github.com/shinneider.png","language":"Python","funding_links":[],"categories":["Third-Party Packages"],"sub_categories":["Search"],"readme":"Django Admin Search\n===================\n[![Downloads](https://pepy.tech/badge/django-admin-search)](https://pepy.tech/project/django-admin-search)\n[![Downloads](https://pepy.tech/badge/django-admin-search/month)](https://pepy.tech/project/django-admin-search/month)\n[![Downloads](https://pepy.tech/badge/django-admin-search/week)](https://pepy.tech/project/django-admin-search/week)\n\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=shinneider_django-admin-search\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=shinneider_django-admin-search)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=shinneider_django-admin-search\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=shinneider_django-admin-search)\n[![PyPI version](https://badge.fury.io/py/django-admin-search.svg)](https://badge.fury.io/py/django-admin-search)  \nThe \"Django Admin Search\" is a advanced search modal for django admin.\n\nIf you use or like the project, click `Star` and `Watch` to generate metrics and i evaluate project continuity.\n\n# Install:\n    pip install django-admin-search\n\n# Usage:\n\n1. Add to your INSTALLED_APPS, in settings.py:\n    ```\n    INSTALLED_APPS = [  \n        ...\n        'django_admin_search',\n        ...\n    ]\n    ```\n\n2. Create a search form for model:\n    ```\n    from .models import Area\n    from django.forms import ModelForm, Form\n    from django.forms import DateField, CharField, ChoiceField, TextInput\n\n\n    class YourFormSearch(Form):\n        name = CharField(required=False)\n        date = DateField(required=False, widget=TextInput(\n            attrs={ \n                'filter_method': '__gte',\n            }\n        ))\n    ```\n\n3. In your admin:\n    ```\n    from django_admin_search.admin import AdvancedSearchAdmin\n    from .models import YourModel\n    from .form import YourForm, YourFormSearch\n\n    @register(YourModel)\n    class YourAdmin(AdvancedSearchAdmin):\n        form = YourForm\n        search_form = YourFormSearch\n    ```\n\n# Advanced:\n1. to multiple filters in same field:\n    ```\n    class YourFormSearch(Form):\n        ...\n        name = CharField(required=False)\n        begin = DateField(required=False, widget=TextInput(\n            attrs={\n                'filter_field': 'date', \n                'filter_method': '__gte',\n            }\n        ))\n        end = DateField(required=False, widget=TextInput(\n            attrs={\n                'filter_field': 'date', \n                'filter_method': '__lte',\n            }\n        ))\n    ```\n\n2. add placeholder and mask\n    ```\n    class YourFormSearch(Form):\n        ...\n        date = DateField(required=False, widget=TextInput(\n            attrs={\n                'data-mask': \"00/00/0000\", \n                'placeholder': 'MM/DD/YYYY'\n            }\n        ))\n    ```\n\n3. Custom filter query for a field\n    ```\n    from django_admin_search.admin import AdvancedSearchAdmin\n    from .models import YourModel\n    from .form import YourForm, YourFormSearch\n\n    @register(YourModel)\n    class YourAdmin(AdvancedSearchAdmin):\n        def search_FieldNameHere(request, field_value, param_values):\n            \"\"\"\n                intercept query filter for description field\n            \"\"\"\n            query = Q()\n            # your Q logic here\n            return query\n    ```\n\n# Images:\n\nButton in admin list:\n    ![input](https://user-images.githubusercontent.com/30196992/59556917-19182f00-8fa2-11e9-9d9a-955d73d79d11.png)\n\nModal opened:\n    ![modal](https://user-images.githubusercontent.com/30196992/59556920-29c8a500-8fa2-11e9-8677-0f340762e64a.png)\n\n\n# Development and Running the Tests\nTo do development work for Django Admin Search, clone it locally, make and activate a virtualenv for it, then from within the project directory:\n```\npip install -e \".[dev]\"\n```\n\nTo run the tests:\n```\npytest\n```\n\nIf your work in high difficult test, and need to re run the test every time, use `pytest-watch`:\n```\nptw  # this see file change and re run a test\n```\n\nwhen you need to see passed lines by test, run \n```\npytest --cov-report html\n```\nafter this, will be created a `htmlcov` folder in the root \n\nTo run sonar \n```\npytest --cov-report xml\npylint ./django_admin_search/ --msg-template=\"{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}\" | tee pylint.txt\nsonar-scanner\n```\n\nSee your code quality in Sonar (in testing, no metrics to approve yet)\n```\nhttps://sonarcloud.io/dashboard?id=shinneider_django-admin-search\n```\n\nFor future i want to run test's in Travis CI, to check if PR is Ok, but to be effective, i need to cover 80% or more of the code, help-me creating a test case, see this issue [PR - 20](https://github.com/shinneider/django-admin-search/issues/20)\n\n# Need a Maintainer\n In the last months i don't have much time, health problemas, change of country and others problems.  \n i have some surgeries for first part of 2022, and all of my current project don't use django-admin.  \n for these reasons, i need a help for a project continuation!!  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinneider%2Fdjango-admin-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinneider%2Fdjango-admin-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinneider%2Fdjango-admin-search/lists"}