A global search for Django Admin UI
Project description
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.
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.
- Add
admin_global_search
to yourINSTALLED_APPS
setting beforedjango.contrib.admin
.
INSTALLED_APPS = [
"admin_global_search",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
...
]
- Ensure your models have a
global_search_fields
attribute that specifies the fields to be included in the search. Example:
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
- Update your project's urls.py to include the GlobalSearchView. Example:
...
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:
- Fork the repository.
- Create a new feature branch for your contribution.
- Commit your changes with a descriptive message.
- Push your changes to GitHub.
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django_admin_global_search-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5a713f76c1c7863ef859324f044675be8d2122702a3cbad933c1ff326579dfb |
|
MD5 | 765fc6abe867941a9e6edc5d8f8e81ed |
|
BLAKE2b-256 | 12c241c687ad5ea45186a4fbcf2f33fc30a66b58889bce38a64ba6607e248aad |
Close
Hashes for django_admin_global_search-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 298f862990bd1db5ea2f78f82c3a4b3b88b69e8321ae9836fe027b96ae4ef456 |
|
MD5 | c9c7e14c514c5c45e66ea06d2c2b13b1 |
|
BLAKE2b-256 | c1a8c1d8ff48b836c7921c960a4422a98a6bcd62239b18be9136c8a8a9205a9a |