Skip to main content

Simple django app that add autocomplete to search inside admin panel.

Project description

Simple django app that add autocomplete to search inside admin panel.

https://raw.githubusercontent.com/linevych/django-search-admin-autocomplete/master/doc/demo.gif

Requirements

  • Python: 3.5+

  • Django: >=1.11

Installation

pip install django-search-admin-autocomplete
# OR
pip install git+https://github.com/linevych/django-search-admin-autocomplete.git
INSTALLED_APPS = [
...
'search_admin_autocomplete',
...
]

Usage

from search_admin_autocomplete.admin import SearchAutoCompleteAdmin

class MyModelAdmin(SearchAutoCompleteAdmin)
    search_fields = ['search_field', ]

admin.site.register(MyModel, MyModelAdmin)

Customization

If admin/change_list.html is customized

admin.py

from search_admin_autocomplete.admin import SearchAutoCompleteAdmin

class MyModelAdmin(SearchAutoCompleteAdmin)

    change_list_template = 'admin/custom-list.html'

    search_fields = ['search_field', ]

admin.site.register(MyModel, MyModelAdmin)

admin/custom-list.html

{% extends 'search_admin_autocomplete/change_list.html' %}

{% block object-tools %}
Your custom html...
{{ block.super }}
{% endblock %}

MyPy

This project supports MyPy but to run type checks you need Python 3.6+.

pip install -r requirements_dev.txt
PYTHONPATH="$PYTHONPATH:$PWD/example" mypy search_admin_autocomplete

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-search-admin-autocomplete-0.2.1.tar.gz (24.0 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page