django-admin-global-search


Namedjango-admin-global-search JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/stasfilin/django-admin-global-search
SummaryA global search for Django Admin UI
upload_time2025-01-14 18:59:45
maintainerNone
docs_urlNone
authorStanislav Filin
requires_python<4.0,>=3.8
licenseBSD 3-Clause License
keywords django admin global search
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Admin Global Search
[![Downloads](https://static.pepy.tech/badge/django-admin-global-search)](https://pepy.tech/project/django-admin-global-search)
[![Downloads](https://static.pepy.tech/badge/django-admin-global-search/month)](https://pepy.tech/project/django-admin-global-search)
[![Downloads](https://static.pepy.tech/badge/django-admin-global-search/week)](https://pepy.tech/project/django-admin-global-search)

## Introduction
This Django application introduces a GlobalSearchView, designed to perform a global search across various models within the Django admin site.
![alt text](https://github.com/stasfilin/django-admin-global-search/blob/main/assets/main.png)
![alt text](https://github.com/stasfilin/django-admin-global-search/blob/main/assets/results.png)

## Features
* Global Search: Enables searching across multiple models from a single query.
* Dynamic Model Inclusion: Automatically includes models that define `global_search_fields`, allowing for flexible search configurations.
* Admin Integration: Provides direct links to the admin change page for each search result, facilitating easy editing.

## Getting Started:

### Prerequisites
* Python versions 3.8+.
* Django version 3+

### Installation Steps
Install with command `pip install django-admin-global-search`.

### Usage
To use `django-admin-global-search` in your Django project, you need to update your models and URL configurations.
1. Add `admin_global_search` to your `INSTALLED_APPS` setting before `django.contrib.admin`.
```python
INSTALLED_APPS = [
    "admin_global_search",
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    ...
]
```
2. Ensure your models have a `global_search_fields` attribute that specifies the fields to be included in the search. Example:
```python
class Artist(models.Model):
    name = models.CharField(max_length=100)
    bio = models.TextField(blank=True)

    global_search_fields = ("name", "bio")

    def __str__(self):
        return self.name
```
2. Update your project's urls.py to include the GlobalSearchView. Example:
```python
...
from admin_global_search.views import GlobalSearchView


urlpatterns = [
    path("admin/", admin.site.urls),
    path("search/", GlobalSearchView.as_view(), name="admin_global_search"),
    ...
]
```

## Contributing
Contributions to the project are welcome. To contribute:
1. Fork the repository.
2. Create a new feature branch for your contribution.
3. Commit your changes with a descriptive message.
4. Push your changes to GitHub.
5. Submit a pull request for review.

## License
The project is made available under the **BSD 3-Clause License**. Please refer to the LICENSE file for more details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/stasfilin/django-admin-global-search",
    "name": "django-admin-global-search",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "django, admin, global, search",
    "author": "Stanislav Filin",
    "author_email": "stasfilin@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cc/ba/6f94f1ee5682a3e82080515c3286dd0465f3eb2ed7ecafb40fac81aeb7c0/django_admin_global_search-0.0.5.tar.gz",
    "platform": null,
    "description": "# Django Admin Global Search\n[![Downloads](https://static.pepy.tech/badge/django-admin-global-search)](https://pepy.tech/project/django-admin-global-search)\n[![Downloads](https://static.pepy.tech/badge/django-admin-global-search/month)](https://pepy.tech/project/django-admin-global-search)\n[![Downloads](https://static.pepy.tech/badge/django-admin-global-search/week)](https://pepy.tech/project/django-admin-global-search)\n\n## Introduction\nThis Django application introduces a GlobalSearchView, designed to perform a global search across various models within the Django admin site.\n![alt text](https://github.com/stasfilin/django-admin-global-search/blob/main/assets/main.png)\n![alt text](https://github.com/stasfilin/django-admin-global-search/blob/main/assets/results.png)\n\n## Features\n* Global Search: Enables searching across multiple models from a single query.\n* Dynamic Model Inclusion: Automatically includes models that define `global_search_fields`, allowing for flexible search configurations.\n* Admin Integration: Provides direct links to the admin change page for each search result, facilitating easy editing.\n\n## Getting Started:\n\n### Prerequisites\n* Python versions 3.8+.\n* Django version 3+\n\n### Installation Steps\nInstall with command `pip install django-admin-global-search`.\n\n### Usage\nTo use `django-admin-global-search` in your Django project, you need to update your models and URL configurations.\n1. Add `admin_global_search` to your `INSTALLED_APPS` setting before `django.contrib.admin`.\n```python\nINSTALLED_APPS = [\n    \"admin_global_search\",\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"django.contrib.contenttypes\",\n    ...\n]\n```\n2. Ensure your models have a `global_search_fields` attribute that specifies the fields to be included in the search. Example:\n```python\nclass Artist(models.Model):\n    name = models.CharField(max_length=100)\n    bio = models.TextField(blank=True)\n\n    global_search_fields = (\"name\", \"bio\")\n\n    def __str__(self):\n        return self.name\n```\n2. Update your project's urls.py to include the GlobalSearchView. Example:\n```python\n...\nfrom admin_global_search.views import GlobalSearchView\n\n\nurlpatterns = [\n    path(\"admin/\", admin.site.urls),\n    path(\"search/\", GlobalSearchView.as_view(), name=\"admin_global_search\"),\n    ...\n]\n```\n\n## Contributing\nContributions to the project are welcome. To contribute:\n1. Fork the repository.\n2. Create a new feature branch for your contribution.\n3. Commit your changes with a descriptive message.\n4. Push your changes to GitHub.\n5. Submit a pull request for review.\n\n## License\nThe project is made available under the **BSD 3-Clause License**. Please refer to the LICENSE file for more details.\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "A global search for Django Admin UI",
    "version": "0.0.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/stasfilin/django-admin-global-search/issues",
        "Homepage": "https://github.com/stasfilin/django-admin-global-search",
        "Repository": "https://github.com/stasfilin/django-admin-global-search"
    },
    "split_keywords": [
        "django",
        " admin",
        " global",
        " search"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c88365c740276c0b6f500c5550a205f936d540482d0f1a61cb4fb6a9175a609a",
                "md5": "95b3cfef07e2d4f5e5ec236f21d9a3c3",
                "sha256": "a52d73d129830a4d95c172ffa08849d70a87f2f1ff94a256c3852f157821280e"
            },
            "downloads": -1,
            "filename": "django_admin_global_search-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "95b3cfef07e2d4f5e5ec236f21d9a3c3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 8074,
            "upload_time": "2025-01-14T18:59:44",
            "upload_time_iso_8601": "2025-01-14T18:59:44.058901Z",
            "url": "https://files.pythonhosted.org/packages/c8/83/65c740276c0b6f500c5550a205f936d540482d0f1a61cb4fb6a9175a609a/django_admin_global_search-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ccba6f94f1ee5682a3e82080515c3286dd0465f3eb2ed7ecafb40fac81aeb7c0",
                "md5": "072104c89e77e07c6682594528cc8048",
                "sha256": "2a5403060ca58e8b2820d62bf680e1c4192a07ff7bd66691769ed998e16dafff"
            },
            "downloads": -1,
            "filename": "django_admin_global_search-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "072104c89e77e07c6682594528cc8048",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 5581,
            "upload_time": "2025-01-14T18:59:45",
            "upload_time_iso_8601": "2025-01-14T18:59:45.216617Z",
            "url": "https://files.pythonhosted.org/packages/cc/ba/6f94f1ee5682a3e82080515c3286dd0465f3eb2ed7ecafb40fac81aeb7c0/django_admin_global_search-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-14 18:59:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stasfilin",
    "github_project": "django-admin-global-search",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-admin-global-search"
}
        
Elapsed time: 0.70695s