{% extends "admin/base_site.html" %}
{% load i18n %}

{% block content %}
<h1>{% translate "Favorites" %}</h1>
{% if favorites %}
<form method="post">
  {% csrf_token %}
  <table class="listing">
    <thead>
      <tr>
        <th>{% translate "Model" %}</th>
        <th>{% translate "Custom Label" %}</th>
        <th>{% translate "Priority" %}</th>
        <th>{% translate "Mark as User Data" %}</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
    {% for fav in favorites %}
      <tr>
        <td>{{ fav.content_type.name }}</td>
        <td>{{ fav.custom_label }}</td>
        <td>
          <label class="visually-hidden" for="id_priority_{{ fav.pk }}">{% translate "Priority" %}</label>
          <input type="number" id="id_priority_{{ fav.pk }}" name="priority_{{ fav.pk }}" value="{{ fav.priority }}">
        </td>
        <td><input type="checkbox" name="user_data" value="{{ fav.pk }}" {% if fav.user_data %}checked{% endif %}></td>
        <td><a href="{% url 'admin:favorite_delete' fav.pk %}">{% translate "Remove" %}</a></td>
      </tr>
    {% endfor %}
    </tbody>
  </table>
  <div class="submit-row">
    <input type="submit" value="{% translate 'Save' %}" class="default">
  </div>
</form>
<p><a href="{% url 'admin:favorite_clear' %}">{% translate "Remove all favorites" %}</a></p>
{% else %}
<p>{% translate "No favorites." %}</p>
{% endif %}
{% endblock %}
