{% extends "default.html" %}

{% block body %}
{% if versions %}
    {% for version in versions %}
    {% if forloop.first %}
    <h1>Versions for {{ version.get_object }}</h1>
    <table>
    <tr>
        <th>Number</th>
        <th>Version Date</th>
        <th>Creator</th>
        <th>Link</th>
    </tr>
    {% endif %}
    <tr>
        <td>{{ forloop.counter }}</td>
        <td>{{ version.create_dt }}</td>
        <td>{{ version.user.username }}</td>
        <td><a href="{{ version.get_object_version_url }}">View</a></td>
    <tr>
    {% if forloop.last %}
    <tr>
        <td>Current</td>
        <td>{{ version.get_object.update_dt }}</td>
        <td>{{ version.get_object.owner_username }}</td>
        <td><a href="{{ version.get_object.get_absolute_url }}">View</a></td>
    </tr>
    {% endif %}

    {% endfor %}
</table>
{% else %}
<h1>No Old Versions Found</h1>
{% endif %}

{% endblock body %}