如何更改 Django 管理搜索框的位置?
How can i change the location of the Django admin search-box?
enter image description here
我想将 Django-admin 页面上的搜索框和操作框移动到页面底部。
我已经找到 Django-admin change_list.html 文件,但我不知道如何更改它...
我该怎么做?
go to dir(django安装路径)
C:\venvs\Lib\site-packages\django\contrib\admin\templates\admin\change_list.html
把两条线放在最下面的位置。
{% 块搜索 %}{% search_form cl %}{% endblock %}
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
把两条线放在最下面的位置。
<div class="changelist-form-container">
<!--remove this lines -->
<!--remove this lines -->
<!-- {% block search %}{% search_form cl %}{% endblock %}
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %} -->
<!--remove this lines -->
<!--remove this lines -->
<form id="changelist-form" method="post" {% if cl.formset and cl.formset.is_multipart %}
enctype="multipart/form-data" {% endif %} novalidate>{% csrf_token %}
{% if cl.formset %}
<div>{{ cl.formset.management_form }}</div>
{% endif %}
{% block result_list %}
{% if action_form and actions_on_top and cl.show_admin_actions %}{% admin_actions %}{% endif %}
{% result_list cl %}
{% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %}
{% endblock %}
{% block pagination %}{% pagination cl %}{% endblock %}
</form>
<!-- add this lines -->
<!-- add this lines -->
{% block search %}{% search_form cl %}{% endblock %}
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
<!-- add this lines -->
<!-- add this lines -->
</div>
enter image description here
我想将 Django-admin 页面上的搜索框和操作框移动到页面底部。
我已经找到 Django-admin change_list.html 文件,但我不知道如何更改它...
我该怎么做?
go to dir(django安装路径)
C:\venvs\Lib\site-packages\django\contrib\admin\templates\admin\change_list.html
把两条线放在最下面的位置。
{% 块搜索 %}{% search_form cl %}{% endblock %}
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
把两条线放在最下面的位置。
<div class="changelist-form-container">
<!--remove this lines -->
<!--remove this lines -->
<!-- {% block search %}{% search_form cl %}{% endblock %}
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %} -->
<!--remove this lines -->
<!--remove this lines -->
<form id="changelist-form" method="post" {% if cl.formset and cl.formset.is_multipart %}
enctype="multipart/form-data" {% endif %} novalidate>{% csrf_token %}
{% if cl.formset %}
<div>{{ cl.formset.management_form }}</div>
{% endif %}
{% block result_list %}
{% if action_form and actions_on_top and cl.show_admin_actions %}{% admin_actions %}{% endif %}
{% result_list cl %}
{% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %}
{% endblock %}
{% block pagination %}{% pagination cl %}{% endblock %}
</form>
<!-- add this lines -->
<!-- add this lines -->
{% block search %}{% search_form cl %}{% endblock %}
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
<!-- add this lines -->
<!-- add this lines -->
</div>