{% extends 'gestion/base_minimale.html' %}
{% load static %}

{% block contents %}
<h1>{{ nom_page }}</h1>
<form method="post">
  {% csrf_token %}
  <table class="deux-colonnes-formulaire"
	 style="display: inline-block; vertical-align: top;">
    {{ form.as_table }}
    <tr>
      <td>
	<button id="buttonPasse" type="button" onclick="changePasse()">
	  Changer le mot de passe ...
	</button>
      </td>
      <td><input type="submit" value="Valider" style="width: 100%;"/></td></tr>
  </table>
</form>
<script>
  var passInputs = $("#id_passe1, #id_passe2");
  if ($(".errorlist").length){
      $("#buttonPasse").hide();
  } else {
      passInputs.parent().parent().hide();
  }
  function changePasse(){
      $("#buttonPasse").fadeOut();
      passInputs.parent().parent().fadeIn();
  }
</script>
{% endblock %}
