1

メザニンサイトでの認証にMozilla Personadjango-browseridを使用していますが、メザニンのパスワード フィールドは必要ありません。

Mezzanine のアカウント フィールドの設定を制限しようとしましたが、機能せず、プロファイル フィールドが引き続き表示されます。

ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS = (
    "email",
    "password1",
    "password2",
)

Django および Mezzanine のパスワード フィールドを除外または無効にする方法はありますか? Persona でログインするユーザーに使用できないパスワードを自動的に設定する可能性がありますか? Mezzanine の Accounts アプリ、特に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>
4

0 に答える 0