django-admin-global-search


Namedjango-admin-global-search JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/stasfilin/django-admin-global-search
SummaryA global search for Django Admin UI
upload_time2024-02-12 11:23:46
maintainer
docs_urlNone
authorStanislav Filin
requires_python>=3.8,<4.0
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": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "django,admin,global,search",
    "author": "Stanislav Filin",
    "author_email": "stasfilin@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d8/cc/6c6d90dffb20229cae03f283df430f158889aef6a116311064e385c4baea/django_admin_global_search-0.0.3.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.3",
    "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": "4cc4b0f88e874d1906f0c58ef411b246c4dc45113410862a5e48797009407bea",
                "md5": "b4524523233401974710fb8d413f3989",
                "sha256": "14f1636c1cbd083c6f0e91131fc8d6352170f5e7650c575b11a0d06d6cd9dcd5"
            },
            "downloads": -1,
            "filename": "django_admin_global_search-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b4524523233401974710fb8d413f3989",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 8014,
            "upload_time": "2024-02-12T11:23:44",
            "upload_time_iso_8601": "2024-02-12T11:23:44.623773Z",
            "url": "https://files.pythonhosted.org/packages/4c/c4/b0f88e874d1906f0c58ef411b246c4dc45113410862a5e48797009407bea/django_admin_global_search-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8cc6c6d90dffb20229cae03f283df430f158889aef6a116311064e385c4baea",
                "md5": "c9f891c513b845b035e4e85946706c2d",
                "sha256": "2bd19c0c17bc0b31794ded779a62b1f8cbd2cb30897e92ed6295950a20234e26"
            },
            "downloads": -1,
            "filename": "django_admin_global_search-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c9f891c513b845b035e4e85946706c2d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 5726,
            "upload_time": "2024-02-12T11:23:46",
            "upload_time_iso_8601": "2024-02-12T11:23:46.156152Z",
            "url": "https://files.pythonhosted.org/packages/d8/cc/6c6d90dffb20229cae03f283df430f158889aef6a116311064e385c4baea/django_admin_global_search-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-12 11:23:46",
    "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.19798s