{% load i18n admin_extras favorites %}

<tr class="model-{{ model_name }}{% if model.admin_url in request.path|urlencode %} current-model{% endif %}">
  <th scope="row" id="{{ row_dom_id }}">
    <span class="dashboard-model-cell">
      {% if ct_id %}
        <a
          href="{% url 'admin:favorite_toggle' ct_id %}?next={{ request.get_full_path|urlencode }}"
          class="favorite-star{% if fav %} favorited{% endif %}"
          title="{% translate 'Toggle favorite' %}"
          aria-label="{% translate 'Toggle favorite' %}"
        >
          &#9733;
        </a>
      {% endif %}
      <span class="dashboard-model-heading">
        <span class="dashboard-model-name">
          {% if model.admin_url %}
            <a href="{{ model.admin_url }}"{% if model.admin_url in request.path|urlencode %} aria-current="page"{% endif %}>{{ fav.custom_label|default:model.name }}</a>
          {% else %}
            {{ fav.custom_label|default:model.name }}
          {% endif %}
        </span>
        {% if show_model_badges|default:True %}
          {% with model_status=model_statuses|get_status:ct_id %}
            {% if model_status %}
              <span class="dashboard-model-status{% if not model_status.success %} dashboard-model-status--failure{% endif %}" data-model-status-loader>
                {% if model_status.icon %}
                  <span class="dashboard-model-status__icon">{{ model_status.icon }}</span>
                {% endif %}
                <span class="dashboard-model-status__message">{{ model_status.message }}</span>
              </span>
            {% endif %}
          {% endwith %}
        {% endif %}
      </span>
    </span>
  </th>

  {% if model.admin_url and show_changelinks %}
    {% model_admin_actions app_label model.object_name as extra_actions %}
    <td class="actions">
      {% for action in extra_actions %}
        <a href="{{ action.url }}" class="actionlink" aria-describedby="{{ row_dom_id }}">
          {{ action.label }}
        </a>{% if not forloop.last %}&nbsp;{% endif %}
      {% endfor %}
    </td>
  {% else %}
    <td class="actions"></td>
  {% endif %}

  {% if model.add_url %}
    <td><a href="{{ model.add_url }}" class="addlink" aria-describedby="{{ row_dom_id }}">{% translate 'Add' %}</a></td>
  {% else %}
    <td></td>
  {% endif %}

  {% if model.admin_url and show_changelinks %}
    <td>
      <div class="change-link-cell{% if model.view_only %} change-link-cell--view-only{% endif %}" data-label="{% translate 'Change or view list link' %}">
        <a href="{{ model.admin_url }}" class="{% if model.view_only %}viewlink{% else %}changelink{% endif %}" aria-describedby="{{ row_dom_id }}" target="_blank" rel="noreferrer noopener"{% if model.admin_url in request.path|urlencode %} aria-current="page"{% endif %}>
          {% if model.view_only %}
            {% translate 'View' %}
          {% else %}
            {% translate 'Change' %}
          {% endif %}
        </a>
      </div>
    </td>
  {% elif show_changelinks %}
    <td>
      <div class="change-link-cell" data-label="{% translate 'Change or view list link' %}"></div>
    </td>
  {% endif %}
</tr>
