【问题标题】:Django - Admin - 'Add Object' button on Left sideDjango - 管理员 - 左侧的“添加对象”按钮
【发布时间】:2011-06-02 04:27:45
【问题描述】:

默认情况下,在更改列表页面中,“添加对象”按钮位于右侧。是否可以将其移至左侧?我需要对 change_list.html 中的以下几行进行任何更改吗?

{% block object-tools %}
  {% if has_add_permission %}
    <ul class="object-tools">
      <li>
        <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
          {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
        </a>
      </li>
    </ul>
  {% endif %}
{% endblock %}

【问题讨论】:

    标签: django django-admin django-templates


    【解决方案1】:
    {% block content %}
      <div id="content-main">
     <style type="text/css">
            /* Moving the ADD buttons to the left side using CSS */
         .object-tools {
          font-size: 10px;
          font-weight: bold;
          font-family: Arial,Helvetica,sans-serif;
          padding-left: 0;
          float: left;
          position: relative;
          margin-top: 0.5em;
          margin-bottom: -2em;
      }
     </style>
    
        {% block object-tools %}
          {% if has_add_permission %}
            <ul class="object-tools">
              <li>
                <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
                  {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
                </a>
              </li>
            </ul>
          {% endif %}
        {% endblock %}
     <br> <br>
    

    【讨论】:

      猜你喜欢
      • 2015-03-27
      • 2015-01-06
      • 1970-01-01
      • 1970-01-01
      • 2016-08-26
      • 1970-01-01
      • 2019-05-19
      • 2019-12-20
      • 1970-01-01
      相关资源
      最近更新 更多