Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Django Admin Global Search

Downloads Downloads Downloads

Introduction

This Django application introduces a GlobalSearchView, designed to perform a global search across various models within the Django admin site. alt text alt text

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.
INSTALLED_APPS = [
    "admin_global_search",
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    ...
]
  1. 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
  1. 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:

  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.

Release files for django-admin-global-search 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-global-search 0.0.7
File Size Uploaded
django_admin_global_search-0.0.7.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-global-search 0.0.7
File Interpreter ABI Platform
django_admin_global_search-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 16.9 kB

Release files / django_admin_global_search-0.0.7.tar.gz

Download URL django_admin_global_search-0.0.7.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c0816909d016eebd0ab3a124e8ad894ae3e5360256f9bcf13618a6fc1fcddf6b
BLAKE2b-256 checksum
How to use checksums
ffcd770cb1cd22b9ad7211f4076cb8035f1c1a1f7cfaead7e21948672136867c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.14 Linux/6.11.0-1018-azure

Release files / django_admin_global_search-0.0.7-py3-none-any.whl

Download URL django_admin_global_search-0.0.7-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b754386f4e5c32b9eeec839dbca1f2ac128a212b0167e608199b7460e381568
BLAKE2b-256 checksum
How to use checksums
b3ba802880a1c4d4ec50aa144c158d0e771d0740b8323849d0ed4e2e42f6ce28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.14 Linux/6.11.0-1018-azure
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page