diff --git a/README.md b/README.md index 9c14a34..44af5cd 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ## Introduction This Django application introduces a GlobalSearchView, designed to perform a global search across various models within the Django admin site. +![alt text](assets/main.png "Main Page") +![alt text](assets/results.png "Results Page") ## Features * Global Search: Enables searching across multiple models from a single query. @@ -19,7 +21,16 @@ 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. +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): diff --git a/admin_global_search/templates/admin_global_search/results.html b/admin_global_search/templates/admin_global_search/results.html index 9209ae5..eaa06bd 100644 --- a/admin_global_search/templates/admin_global_search/results.html +++ b/admin_global_search/templates/admin_global_search/results.html @@ -25,6 +25,8 @@ {% endblock %} +{% block title %}Results for "{{ query }}" | {{ site_title|default:_('Django site admin') }}{% endblock %} + {% block content %}

{% trans "Search Results" %}

diff --git a/assets/main.png b/assets/main.png new file mode 100644 index 0000000..f4adbad Binary files /dev/null and b/assets/main.png differ diff --git a/assets/results.png b/assets/results.png new file mode 100644 index 0000000..b53deb3 Binary files /dev/null and b/assets/results.png differ diff --git a/dev/dev/settings.py b/dev/dev/settings.py index 88ba726..3993268 100644 --- a/dev/dev/settings.py +++ b/dev/dev/settings.py @@ -31,6 +31,7 @@ # Application definition INSTALLED_APPS = [ + "admin_global_search", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", @@ -38,7 +39,6 @@ "django.contrib.messages", "django.contrib.staticfiles", "music", - "admin_global_search", ] MIDDLEWARE = [ diff --git a/pyproject.toml b/pyproject.toml index 596e40e..ccb7531 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-admin-global-search" -version = "0.0.1" +version = "0.0.2" description = "A global search for Django Admin UI" authors = ["Stanislav Filin "] license = "BSD 3-Clause License"