Skip to main content

A custom Django user model for best practices email-based login.

Project description

This project provides a custom user model that improves on Django’s default by making a few modern and international changes.

  • Uses email as the username to simplify login for users

  • Replace first_name and last_name with international friendly short_name full name fields

Usage

Perform the following steps in your settings.py file.

  1. Add improved_user to INSTALLED_APPS

  2. Define or replace AUTH_USER_MODEL with he new model, as below.

AUTH_USER_MODEL='improved_user.User'
  1. In Django > 1.9, change UserAttributeSimilarityValidator to match correct User fields, as shown below.

AUTH_PREFIX = 'django.contrib.auth.password_validation.'
AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': AUTH_PREFIX + 'UserAttributeSimilarityValidator',
        'OPTIONS': {
            'user_attributes': ('email', 'full_name', 'short_name')
        },
    },
    # include other password validators here
]

Testing

>From the root directory of the project, run the code below.

$ python runtests.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-improved-user-0.1.1.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

django_improved_user-0.1.1-py3-none-any.whl (14.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page