django search admin autocomplete
vments & Bug fixes
Aplicación Django simple que agrega autocompletar para buscar dentro del panel de administración.
pip install django-search-admin-autocomplete
# OR
pip install git+https://github.com/linevych/django-search-admin-autocomplete.git
INSTALLED_APPS = [
...
'search_admin_autocomplete' ,
...
]
from search_admin_autocomplete . admin import SearchAutoCompleteAdmin
class MyModelAdmin ( SearchAutoCompleteAdmin )
search_fields = [ 'search_field' , ]
admin . site . register ( MyModel , MyModelAdmin )
Si admin/change_list.html está personalizado
administrador.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/lista-personalizada.html
{% extends 'search_admin_autocomplete/change_list.html' %}
{% block object-tools %}
Your custom html...
{{ block.super }}
{% endblock %}
Este proyecto es compatible con MyPy, pero para ejecutar comprobaciones de tipos necesita Python 3.6+.
pip install - r requirements_dev . txt
PYTHONPATH = "$PYTHONPATH:$PWD/example" mypy search_admin_autocomplete