Posted by: Max Chen | in Mezzanine | 1 year, 11 months ago |


The accounts functionality is provided by the app mezzanine.accounts.

Adding it to your INSTALLED_APPS setting will enable signup, login, account updating, and password retrieval features for the public site.


Profiles are implemented via the ACCOUNTS_PROFILE_MODEL setting. With mezzanine.accounts installed, you can create a profile model in one of your apps, with each of the profile fields defined, as well as a related field to Django’s user model. For example suppose we wanted to capture bios and dates of birth for each user:

In myapp/

from django.db import models

class MyProfile(models.Model):
    user = models.OneToOneField("auth.User")
    date_of_birth = models.DateField(null=True)
    bio = models.TextField()

# In

    # Many more


The bio and date of birth fields will be available in the signup and update profile forms, as well as in the user’s public profile page.

Profile pages are automatically made available when a profile model is configured

Restricting Account Fields

By default, Mezzanine will expose all relevant user and profile fields available in the signup and update profile forms, and the user’s profile page.

However you may want to store extra fields in user profiles, but not expose these fields to the user.

You may also want to have no profile model at all, and strip the signup and update profile forms down to only the minimum required fields on the user model, such as username and password.

Mezzanine defines the setting ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS which allows you to define a sequence of field names, for both the user and profile models, that won’t be exposed to the user in any way.

Suppose we define a DateTimeField on the profile model called signup_date which we don’t want exposed.

We also might not bother asking the user for their first and last name, which are fields defined by Django’s user model.

In our module we would define:


If you don’t want to expose the username field to the user, Mezzanine provides the setting ACCOUNTS_NO_USERNAME, which when set to True, will expose the email field as the sole login for the user.

Account Verification

By default, with mezzanine.accounts installed, any public visitor to the site can sign up for an account and will be logged in after signup.

However you may wish to validate that new accounts are only created by real people with real email addresses.

To enable this, Mezzanine provides the setting


which when set to True, will send new user an email with a verification link that they must click on, in order to activate their account.

Account Approval

You may also wish to manually activate newly created public accounts.

To enable this, Mezzanine provides the setting


which when set to True, will set newly created accounts as inactive, requiring a staff member to activate each account in the admin interface.

A list of email addresses can be configured in the admin settings interface, which will then be notified by email each time a new account is created and requires activation.

Users are then sent a notification when their accounts are activated by a staff member.


tags: Mezzanine
Currently unrated


* indicates required

Recent Posts




Apache 1

Data Science 2

Dbfit 1

Design Pattern 1

Devops 4

DigitalOcean 1

Django 1

English 3

Excel 5


Flask 3

Git 1

HackMD 1

Heroku 1

Html/Css 1

Linux 4


Machine Learning 2

Manufacture 1

Master Data Service 1

Mezzanine 18

Oracle 1

Postgresql 7

PowerBI 4

Powershell 4

Python 22


SQL Server 53

SQL Server Analytics Service 1

SQLite 1

Windows 1

database 8

work-experience 1

其他 1

投資入門 1

投資心得 2

時間管理 1

總體經濟 2

自我成長 3

資料工程 1


SEO(1) Github(2) Title Tag(2) ML(1) 李宏毅(1) SQL Server(18) Tempdb(1) SSMS(1) Windows(1) 自我成長(2) Excel(1) python Flask(1) python(5) Flask(2)


Max Chen (159)


RSS / Atom


© COPYRIGHT 2011-2022. Max的文藝復興. ALL RIGHT RESERVED.