{% extends "admin/base.html" %}
{% load i18n static %}
{% load admin_urls %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">{% endblock %}
{% block bodyclass %}{{ block.super }} {{ opts.app_label }}-{{ opts.model_name }} change-form{% endblock %}
{% if not is_popup %}
  {% block breadcrumbs %}
    <nav class="breadcrumb" aria-label="breadcrumbs">
      <ul>
	<li><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></li>
	<li><a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a></li>
	<li><a href="{% url opts|admin_urlname:'change' original.pk|admin_urlquote %}">{{ original|truncatewords:"18" }}</a></li>
	<li class="is-active"><a href="#">修改密码</a></li>
      </ul>
    </nav>    
  {% endblock %}
{% endif %}
{% block content %}
  <div id="content-main">
    <form{% if form_url %} action="{{ form_url }}"{% endif %} method="post" id="{{ opts.model_name }}_form" style="max-width:400px;">{% csrf_token %}{% block form_top %}{% endblock %}
      <input type="hidden" name="username" value="{{ original.get_username }}" class="hidden">
      <div>
	{% if is_popup %}<input type="hidden" name="_popup" value="1">{% endif %}
	{% if form.errors %}
	  <div class="notification is-danger is-light">
	    {% if form.errors.items|length == 1 %}{% translate "Please correct the error below." %}{% else %}{% translate "Please correct the errors below." %}{% endif %}
	  </div>
	{% endif %}

	<p class="block">{% blocktranslate with username=original %}Enter a new password for the user <strong>{{ username }}</strong>.{% endblocktranslate %}</p>



	<div class="field">
	  <label class="label" >{{form.password1.label}}</label>
	  <div class="control" >
	    <input type="password" name="{{form.password1.name}}" class="input {% if form.password1.errors %}is-danger{% endif %}" required />
	  </div>
	  {% if form.password1.help_text %}
	    <div class="help">{{ form.password1.help_text|safe }}</div>
	  {% endif %}
	  {% if form.password1.errors %}
	    <div class="help is-danger">{{ form.password1.errors }}</div>
	  {% endif %}
	</div>

	<div class="field">
	  <label class="label" >{{form.password2.label}}</label>
	  <div class="control" >
	    <input type="password" name="{{form.password2.name}}" class="input {% if form.password2.errors %}is-danger{% endif %}" required />
	  </div>
	  {% if form.password2.help_text %}
	    <div class="help">{{ form.password2.help_text|safe }}</div>
	  {% endif %}
	  {% if form.password2.errors %}
	    <div class="help is-danger">{{ form.password2.errors }}</div>
	  {% endif %}
	</div>

	<div class="field mt-5">
	  <input type="submit" value="{% translate 'Change password' %}" class="button is-primary is-fullwidth">
	</div>

      </div>
    </form></div>
{% endblock %}
