{% load admin_urls i18n wn_filters %} {% comment %} Nếu có hidden fields, render chúng (nếu cần) {% endcomment %} {% if result_hidden_fields %}
{% for item in result_hidden_fields %} {{ item }} {% endfor %}
{% endif %} {% if results %} {# Sử dụng CSS Grid: 1 cột trên mobile, 2-3 cột trên màn hình lớn hơn #}
{% if cl.model_admin.grid_cols %}
{% else %}
{% endif %} {% for result in results %} {# Nếu có lỗi cho object cụ thể, hiển thị thông báo lỗi chiếm toàn bộ hàng #} {% if result.form and result.form.non_field_errors %}
{{ result.form.non_field_errors }}
{% endif %} {# Flag hiển thị ở góc nếu record đã bị xóa #}
{# Lặp qua các cell của kết quả, bỏ qua phần tử đầu tiên (thường là checkbox cột) #} {% for item in result %} {# Dùng forloop.counter0 (bắt đầu từ 0) để lấy header tương ứng từ result_headers #} {% with header=result_headers|get_item:forloop.counter0 %} {# Header của item #} {% if header.class_attrib and 'action-checkbox' in header.class_attrib %} {# skip #} {% elif header.text and header.text != 'Header' %} {% trans "Deleted" as deleted_text %} {% if header.text == deleted_text %} {% if "True" in item %} Deleted {% endif %} {% else %} {# Nếu header có text, hiển thị header và giá trị #}
{{ header.text|capfirst }}
{{ item }}
{% endif %} {% else %} {{ item }} {% endif %} {% endwith %} {% endfor %} {# Hiển thị các hành động (Edit, Delete,...) cho dòng #}
{% include 'unfold/helpers/actions_row.html' with actions=actions_row instance_pk=result.instance_pk %}
{% endfor %}
{% else %} {# Nếu không có kết quả, hiển thị thông báo "No results found" #} {% url cl.opts|admin_urlname:"add" as add_url %} {% blocktranslate with name=cl.opts.verbose_name asvar title %}Add {{ name }}{% endblocktranslate %}
inbox

{% trans "No results found" %}

{% trans "This page yielded into no results. Create a new item or reset your filters." %}

{% if has_add_permission or cl.has_filters %}
{% if has_add_permission %} add {{ title }} {% endif %} {% if cl.has_filters %} filter_list_off {% trans "Reset filters" %} {% endif %}
{% endif %}
{% endif %}