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
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
File details
Details for the file django_admin_global_search-0.0.4.tar.gz
.
File metadata
- Download URL: django_admin_global_search-0.0.4.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87766ada9406e0e60a34a6646d8ecdd42cceb1a1a9cb800159911fbeeda4994f |
|
MD5 | ad4113391daf364ad415a1a9b846e3d4 |
|
BLAKE2b-256 | 8ef2a9326ed7ccaf7a76ee147a0e9c1354e0d3edfce86043d40409e8942532d1 |
File details
Details for the file django_admin_global_search-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: django_admin_global_search-0.0.4-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d012eebe92c06b96bfbbba1f549a724551b48402fbd68e9f6de35d4c38efd08e |
|
MD5 | 65987dcd2f333127c84e59f38a9919f2 |
|
BLAKE2b-256 | 6f8ee60b8d3f90b51943f279f2315a1fea4f8936ccba1253608b2f2cb7297100 |