我希望稍微修改django-registration提供的默认password_reset_form.html。目前的输出是:
我想删除电子邮件地址:'标签并放置一个占位符'输入框内的文本。你怎么能做到这一点?我似乎无法在form.email或form.email.errors找到文档。
Password_reset_form.html如下所示:
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Reset password" %}{% endblock %}
{% block content %}
<p>
{% blocktrans %}
Forgot your password? Enter your email in the form below and we'll send you instructions for creating a new one.
{% endblocktrans %}
</p>
<form method="post" action="">
{% csrf_token %}
{{ form.email.errors }}
<p><label for="id_email">{% trans 'E-mail address:' %}</label> {{ form.email }} <input type="submit" value="{% trans 'Reset my password' %}" /></p>
</form>
{% endblock %}
{# This is used by django.contrib.auth #}
答案 0 :(得分:0)
您可以使用this package。
所以你的代码看起来像这样。
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% load widget_tweaks %}
{% block title %}{% trans "Reset password" %}{% endblock %}
{% block content %}
<p>
{% blocktrans %}
Forgot your password? Enter your email in the form below and we'll send you instructions for creating a new one.
{% endblocktrans %}
</p>
<form method="post" action="">
{% csrf_token %}
{{ form.email.errors }}
<p> {{ form.email|attr:"placeholder:E-mail address:" }} <input type="submit" value="{% trans 'Reset my password' %}" /></p>
</form>
{% endblock %}
{# This is used by django.contrib.auth #}