开发者

Django - Admin - 'Add Object' button on Left side

开发者 https://www.devze.com 2023-02-02 13:23 出处:网络
By default, in the change list page, the \'Add Object\' button is in right side. Is it possible to move it to the left side? Do I need to do any change in the following lines in change_list.html?

By default, in the change list page, the 'Add Object' button is in right side. Is it possible to move it to the left side? Do I need to do any change in the following lines in 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 %}


{% 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>
0

精彩评论

暂无评论...
验证码 换一张
取 消