【发布时间】:2012-11-06 03:29:35
【问题描述】:
我想覆盖默认的管理面板结果列表 (change_list_results.html) 为<tr> 中的每一行添加 ID
默认为:
<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>
我想要:
<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' %}" id="{{ ID }}">{% for item in result %}{{ item }}{% endfor %}</tr>
{% endfor %}
</tbody>
我应该在{{ ID }} 中输入什么来获取元素 ID?
【问题讨论】:
-
{{ID}}这个属于什么?你在这里需要什么身份证?出于什么原因? -
它只是一个占位符。我需要这个,因为我想创建拖放功能(JS)来对项目进行排序。所以我需要每个 TR 的 id。
标签: django django-templates django-admin