{% include "django/forms/widgets/input.html" %}
<a class="button" id="id_show_password">Show</a>

<script type="text/javascript">
    var $ = django.jQuery;
    var togglePasswordDisplayButton = $('#id_show_password');
    var passwordField = $('#id_{{widget.name}}');
    togglePasswordDisplayButton.click(function() {
      if(passwordField.attr('type') === 'password') {
        passwordField.attr('type', 'text');
        togglePasswordDisplayButton.text('Hide');
      } else {
        passwordField.attr('type', 'password');
        togglePasswordDisplayButton.text('Show');
      }
    });
</script>
