# 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/8e/f2/a9326ed7ccaf7a76ee147a0e9c1354e0d3edfce86043d40409e8942532d1/django_admin_global_search-0.0.4.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.4",
"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": "6f8ee60b8d3f90b51943f279f2315a1fea4f8936ccba1253608b2f2cb7297100",
"md5": "65987dcd2f333127c84e59f38a9919f2",
"sha256": "d012eebe92c06b96bfbbba1f549a724551b48402fbd68e9f6de35d4c38efd08e"
},
"downloads": -1,
"filename": "django_admin_global_search-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "65987dcd2f333127c84e59f38a9919f2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 8063,
"upload_time": "2024-09-05T11:46:08",
"upload_time_iso_8601": "2024-09-05T11:46:08.489840Z",
"url": "https://files.pythonhosted.org/packages/6f/8e/e60b8d3f90b51943f279f2315a1fea4f8936ccba1253608b2f2cb7297100/django_admin_global_search-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8ef2a9326ed7ccaf7a76ee147a0e9c1354e0d3edfce86043d40409e8942532d1",
"md5": "ad4113391daf364ad415a1a9b846e3d4",
"sha256": "87766ada9406e0e60a34a6646d8ecdd42cceb1a1a9cb800159911fbeeda4994f"
},
"downloads": -1,
"filename": "django_admin_global_search-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "ad4113391daf364ad415a1a9b846e3d4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 6589,
"upload_time": "2024-09-05T11:46:09",
"upload_time_iso_8601": "2024-09-05T11:46:09.689834Z",
"url": "https://files.pythonhosted.org/packages/8e/f2/a9326ed7ccaf7a76ee147a0e9c1354e0d3edfce86043d40409e8942532d1/django_admin_global_search-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-05 11:46:09",
"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"
}