Доступ к номеру страницы на странице Django -admin, когда данные разбиты на страницы - PullRequest
0 голосов
/ 29 февраля 2020

В change_list_results. html Я хочу получить доступ к текущему номеру страницы в случае необходимости нумерации страниц. Как мне этого добиться?

Вот список изменений_ *. 1006 *, где я хочу получить информацию о странице:

{% load i18n static %}

{% if results %}
  <div class="results table-responsive">
    <table id="result_list" class="table table-striped">
      <thead>
        <tr>
        {% for header in result_headers %}
          <th scope="col" {{ header.class_attrib }}>
          {% if header.sortable %}
            {% if header.sort_priority > 0 %}
              <div class="sortoptions">
                <a class="sortremove" href="{{ header.url_remove }}" title="{% trans "Remove from sorting" %}">
                  <span class="glyphicon glyphicon-remove"></span>
                </a>
                {% if num_sorted_fields > 1 %}<span class="sortpriority" title="{% blocktrans with priority_number=header.sort_priority %}Sorting priority: {{ priority_number }}{% endblocktrans %}">{{ header.sort_priority }}</span>{% endif %}
                <a href="{{ header.url_toggle }}" class="toggle" title="{% trans "Toggle sorting" %}">
                  <span class="glyphicon glyphicon-chevron-{% if header.ascending %}down ascending{% else %}up descending{% endif %}"></span>
                </a>
              </div>
            {% endif %}
          {% endif %}
             <div class="text">{% if header.sortable %}<a href="{{ header.url_primary }}">{{ header.text|capfirst }}</a>{% else %}<span>{{ header.text|capfirst }}</span>{% endif %}</div>
          </th>{% endfor %}
        </tr>
      </thead>
      <tbody>
        {% for result in results %}
          {% if result.form.non_field_errors %}
            <tr><td colspan="{{ result|length }}">{{ result.form.non_field_errors }}</td></tr>
          {% endif %}
            <tr class="{% cycle 'row1' 'row2' %}">{% for item in result %}{{ item }}{% endfor %}</tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
{% endif %}

{% if result_hidden_fields %}
  <div class="hiddenfields">{# DIV for HTML validation #}
    {% for item in result_hidden_fields %}{{ item }}{% endfor %}
  </div>
{% endif %}
...