django-better-search
This repo is heavily influenced by django-admin-search and copies some of the components as well.
This repo implements search on Django admin page differently. It generates different search boxes for separate fields and doesn't treat all of those fields as string.
Requirements
This app is tested using following:
- Django >= 3.2
- Python >= 3.9
Installation
This repo is published on Pypi. You can install it from there using following:
pip install django-better-search
Usage
Note: This project is not yet ready for production use.
- Add
django_separate_searchin yourINSTALLED_APPS. Example:
INSTALLED_APPS = [
...
"django_separate_search",
...
]
- Create a search form to have search fields on your admin page. Example:
from django.forms import CharField, Form, IntegerField
class UserSearchForm(Form):
name = CharField(required=False, label="User's Name", help_text="Some help_text")
age = IntegerField(required=False, label="User's Age", help_text="Another help_text")
...
- Use the search form in your AppAdmin in your
admin.py. Example:
from django_separate_search.admin import SeparateSearchAdmin
class UserAdmin(SeparateSearchAdmin):
...
search_form = UserSearchForm
...
This will render your search-form fields on the list-view admin page.
- If you want to implement search on a custom field, you will have to implement search_
<field_name>. Example:
class UserAdmin(SeparateSearchAdmin):
...
def search_<field_name>(self, field, field_value, form_field, request, param_values):
query = Q()
// Implement your query
return query
Images
This is how search will look in admin view-list:
Metadata
Release files for django-better-search 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_better_search-0.2.0.tar.gz | 6.9 kB | Without provenance | Details for django_better_search-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_better_search-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for django_better_search-0.2.0-py3-none-any.whl |
Total release size: 15.1 kB
Release files / django_better_search-0.2.0.tar.gz
| Download URL | django_better_search-0.2.0.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aeee2015a4a7222205677db96921ba077f0946d66b05bf8b8253d166c7b83168
|
|
BLAKE2b-256 checksum How to use checksums |
cd54d565663fcafa2264fdea19839e8dca2c9d19e1f07ee12432b1faa311b724
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|
Release files / django_better_search-0.2.0-py3-none-any.whl
| Download URL | django_better_search-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
401078f00bd358709e0c4415e4b5f3e561f089501e63cd348a3de79623179933
|
|
BLAKE2b-256 checksum How to use checksums |
9d00daa1f06d3d8ac1d46ed49970fdd18a48fc3aa60603637fd609dfff82c1ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|
Security for django-better-search 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.