{%extends "key/base.html" %}

{%block content%}
{%for key in object_list%}
  {%if forloop.first%}
    <h3>Active Keys for {{user.username}}</h3>
    <ul>
  {%endif%}
      <li>{{key.key}}  (<a href="{%url key.delete key.key%}">delete</a>)</li>
  {%if forloop.last%}
    </ul>
  {%endif%}
{%empty%}
    <h3>No active keys for {{user.username}}</h3>
{%endfor%}
{%if can_make_api_key %}
{%if available_keys == 'Unlimited' %}
<p>You can create an unlmited number of keys.
{%else%}
<p>You can create {{available_keys}} more keys.
{%endif%}
<form method="POST" action="{%url key.create%}">
  {% csrf_token %}
  <input type="submit" value="Generate API key"/>
</form>

{%endif%}

{%endblock%}
