This Django application introduces a GlobalSearchView, designed to perform a global search across various models within the Django admin site.
BSD-3-CLAUSE License
This Django application introduces a GlobalSearchView, designed to perform a global search across various models within the Django admin site.
global_search_fields
, allowing for flexible search configurations.Install with command pip install django-admin-global-search
.
To use django-admin-global-search
in your Django project, you need to update your models and URL configurations.
admin_global_search
to your INSTALLED_APPS
setting before django.contrib.admin
.INSTALLED_APPS = [
"admin_global_search",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
...
]
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
...
from admin_global_search.views import GlobalSearchView
urlpatterns = [
path("admin/", admin.site.urls),
path("search/", GlobalSearchView.as_view(), name="admin_global_search"),
...
]
Contributions to the project are welcome. To contribute:
The project is made available under the BSD 3-Clause License. Please refer to the LICENSE file for more details.