Skip to main content

django-better-search

Downloads Downloads Downloads

PyPI version

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.

  1. Add django_separate_search in your INSTALLED_APPS. Example:
INSTALLED_APPS = [
    ...
    "django_separate_search",
    ...
]
  1. 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")
    ...
  1. 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.

  1. 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: modal

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)

Source distribution for django-better-search 0.2.0
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)

Table of built distributions (wheels) for django-better-search 0.2.0
File Interpreter ABI Platform Actions
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.

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