我在Mozilla Persona网站上使用django-browserid和Mezzanine进行身份验证,不需要Mezzanine的密码字段。
我尝试了Mezzanine的restricting account fields设置,但它不起作用且配置文件字段仍显示:
ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS = (
"email",
"password1",
"password2",
)
有没有办法排除或禁用Django&夹层密码字段,可能会自动为使用Persona登录的用户设置不可用的密码?我正在查看Mezzanine帐户应用程序中的源代码,特别是ProfileForm,但不确定最佳方法是什么。
更新
现在我已经对模板中的表单字段进行了硬编码,省略了密码字段,例如:
<fieldset>
<legend>{{ title }}</legend>
<form method="post"{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
{# {% fields_for form %} #}
{% csrf_token %}
<input name="referrer" value="//{{request.META.HTTP_HOST}}/users/{{request.user}}/" type="hidden">
{{ form.non_field_errors }}
<div class="control-group input_id_username">
{{ form.username.errors }}
<label class="control-label" for="id_username">
{{ form.username.label }}
</label>
<div class="controls">
<input autofocus="" id="id_username" maxlength="30" name="username" required="" value="{{ form.username.value }}" type="text">
<span class="help-inline">Only letters, numbers, dashes or underscores please.</span>
</div>
</div>
<div class="control-group input_id_website ">
{{ form.website.errors }}
<label class="control-label" for="id_website">
{{ form.website.label }}
</label>
<div class="controls">
<input id="id_website" maxlength="200" name="website" type="text" value="{{ form.website.value|default:'' }}" />
<span class="help-inline"></span>
</div>
</div>
<div class="control-group input_id_bio">
{{ form.bio.errors }}
<label class="control-label" for="id_bio">
{{ form.bio.label }}
</label>
<div class="controls">
<textarea cols="40" id="id_bio" name="bio" rows="10">{{ form.bio.value|default:'' }}</textarea>
<span class="help-inline"></span>
</div>
</div>
<div class="form-actions">
<input class="btn btn-primary btn-large" type="submit" value="{{ title }}"> or <a href="javascript:history.go(-1)">Cancel</a>
</div>
</form>
</fieldset>