{% extends "admin/change_form.html" %}
{% load admin_urls %}

{% block after_related_objects %}
  {{ block.super }}
  <div class="module aligned">
    <h2>Casebooks</h2>
    <div class="form-row">
      <a href="{% url 'admin:main_casebook_changelist' %}?collaborator-id={{ original.id }}">
        View {{ original.attribution }}'s Casebooks
      </a>
    </div>
  </div>
{% endblock %}

{% extends "admin/change_form.html" %}
{% load admin_urls %}

{% block object-tools %}
  {{ block.super }}
  <div class="module">
    <form id="send_email" method="POST" action="{% url 'password_reset' %}" onsubmit="event.preventDefault(); fetch(this.action, {method: 'POST', body: new FormData(this)}).then(data => document.getElementById('email_result').textContent = (data.ok ? 'Success!' : 'Error!'));">
      {% csrf_token %}
      <input type="hidden" name="email" value="{{ original.email_address }}">
      <button class="button" type="submit" value="Upload file and update statuses" style="padding: 7px 15px;">Send {{ original.verified_email|yesno:"Password Reset, Activation"}} Email</button>
      <div id="email_result" class="help"></p>
    </form>
  </div>
{% endblock %}

{% block after_related_objects %}
  {{ block.super }}
  <div class="module aligned">
    <h2>Casebooks</h2>
    <div class="form-row">
      <a href="{% url 'admin:main_casebook_changelist' %}?collaborator-id={{ original.id }}">
        View {{ original.attribution }}'s Casebooks
      </a>
    </div>
  </div>
{% endblock %}

Add a button to send the email from the Django admin.
Add a button to send the email from the Django admin.
