Django:在模板标签中,cl是什么意思?

问题描述 投票:5回答:3

在django管理员更改列表模板中,有一个块:

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

我想知道{% result_list cl %}是什么意思,即cl是什么意思?我在文档中找不到它。

django django-templates templatetags
3个回答
4
投票

[inclusion tag中使用的上下文变量名称

[result_listsource code注释指出它“同时显示标题和数据列表”。


3
投票

这是Changelist:您的模型实例的列表。 Django使用它来处理过滤和分页任务。


2
投票

Changelist不是一般的东西;它是变量的名称,因此不在文档中。在此特定情况中,它是一个包含Changelist对象的变量,但这仅是因为它是传递给模板上下文的内容。

© www.soinside.com 2019 - 2024. All rights reserved.