{% load pretty %}

{% load cache %}

{% cache 600 generic_detail request.user.id object live %}
  {% include 'mixins/partials/notify.html' %}

  {% if live is not None %}
    <h1 class="title">Live {{ context_object_name_singular }} info</h1>
    <table class="table is-fullwidth is-hoverable">
      <thead>
        <th>attribute</th>
        <th>value</th>
      </thead>
      <tbody>
        {% block live_tbody %}
          {% for key, item in live.items %}
            {% if key in pretty %}
              <tr>
                <th>{{ key }}</th>
                <td>
                  {% if item is not None %}
                    <pre>{{ item|pretty }}</pre>
                  {% endif %}
                </td>
              </tr>
            {% else %}
              <tr>
                <th>{{ key }}</th>
                <td>
                  {% if item is not None %}
                    {{ item }}
                  {% endif %}
                </td>
              </tr>
            {% endif %}
          {% endfor %}
        {% endblock %}
      </tbody>
    </table>
  {% endif %}

  {% if object is not None %}
    <h1 class="title">{{ title_singular }} info</h1>
    <table class="table is-fullwidth is-hoverable">
      <thead>
        <th>attribute</th>
        <th>value</th>
      </thead>
      <tbody>
        {% block tbody %}
          {% for key, item in object.items %}
            {% if key in pretty %}
              <tr>
                <th>{{ key }}</th>
                <td>
                  {% if item is not None %}
                    <pre>{{ item|pretty }}</pre>
                  {% endif %}
                </td>
              </tr>
            {% else %}
              <tr>
                <th>{{ key }}</th>
                <td>
                  {% if item is not None %}
                    {{ item }}
                  {% endif %}
                </td>
              </tr>
            {% endif %}
          {% endfor %}
        {% endblock %}
      </tbody>
    </table>
  {% endif %}
{% endcache %}