django search admin autocomplete
vments & Bug fixes
관리자 패널 내부 검색에 자동 완성을 추가하는 간단한 django 앱입니다.
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 )
admin/change_list.html을 사용자 정의한 경우
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 )
관리자/custom-list.html
{% extends 'search_admin_autocomplete/change_list.html' %}
{% block object-tools %}
Your custom html...
{{ block.super }}
{% endblock %}
이 프로젝트는 MyPy를 지원하지만 유형 검사를 실행하려면 Python 3.6 이상이 필요합니다.
pip install - r requirements_dev . txt
PYTHONPATH = "$PYTHONPATH:$PWD/example" mypy search_admin_autocomplete