Note that there are some explanatory texts on larger screens.

plurals
  1. POExcluding password fields from Django / Mezzanine's user account form?
    text
    copied!<p>I'm using <a href="http://persona.org/" rel="nofollow">Mozilla Persona</a> and <a href="http://django-browserid.readthedocs.org/en/" rel="nofollow">django-browserid</a> for authentication in a <a href="http://mezzanine.jupo.org/" rel="nofollow">Mezzanine</a> site and don't need Mezzanine's password fields. </p> <p>I've tried Mezzanine's <a href="http://mezzanine.jupo.org/docs/user-accounts.html#restricting-account-fields" rel="nofollow">restricting account fields</a> settings but it doesn't work and the profile fields still show:</p> <pre><code>ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS = ( "email", "password1", "password2", ) </code></pre> <p>Is there a way to exclude or disable the Django &amp; Mezzanine password fields, maybe automatically setting an unusable password for users that log in with Persona? I'm looking at the source code in Mezzanine's Accounts app, specifically <a href="https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/accounts/forms.py#L64" rel="nofollow">ProfileForm</a>, but am not sure what is the best way to proceed. </p> <p><strong>UPDATE</strong></p> <p>For now I've hard-coded the form fields in the template, omitting password fields, eg:</p> <pre><code>&lt;fieldset&gt; &lt;legend&gt;{{ title }}&lt;/legend&gt; &lt;form method="post"{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}&gt; {# {% fields_for form %} #} {% csrf_token %} &lt;input name="referrer" value="//{{request.META.HTTP_HOST}}/users/{{request.user}}/" type="hidden"&gt; {{ form.non_field_errors }} &lt;div class="control-group input_id_username"&gt; {{ form.username.errors }} &lt;label class="control-label" for="id_username"&gt; {{ form.username.label }} &lt;/label&gt; &lt;div class="controls"&gt; &lt;input autofocus="" id="id_username" maxlength="30" name="username" required="" value="{{ form.username.value }}" type="text"&gt; &lt;span class="help-inline"&gt;Only letters, numbers, dashes or underscores please.&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group input_id_website "&gt; {{ form.website.errors }} &lt;label class="control-label" for="id_website"&gt; {{ form.website.label }} &lt;/label&gt; &lt;div class="controls"&gt; &lt;input id="id_website" maxlength="200" name="website" type="text" value="{{ form.website.value|default:'' }}" /&gt; &lt;span class="help-inline"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group input_id_bio"&gt; {{ form.bio.errors }} &lt;label class="control-label" for="id_bio"&gt; {{ form.bio.label }} &lt;/label&gt; &lt;div class="controls"&gt; &lt;textarea cols="40" id="id_bio" name="bio" rows="10"&gt;{{ form.bio.value|default:'' }}&lt;/textarea&gt; &lt;span class="help-inline"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-actions"&gt; &lt;input class="btn btn-primary btn-large" type="submit" value="{{ title }}"&gt; or &lt;a href="javascript:history.go(-1)"&gt;Cancel&lt;/a&gt; &lt;/div&gt; &lt;/form&gt; &lt;/fieldset&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload