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
Installation
In a Terminal, use pip to install the package from [PyPI](https://pypi.org/).
pip install django-improved-user
If you intend to use the UserFactory provided by the package to allow for testing with [factory_boy](https://github.com/FactoryBoy/factory_boy), you can specify so during install.
pip install django-improved-user[factory]
If you do not but wish to use the UserFactory, you will need to install [factory_boy](https://github.com/FactoryBoy/factory_boy) yourself.
Usage
Perform the following steps in your settings.py file.
Add improved_user.apps.ImprovedUserConfig (or simply improved_user) to INSTALLED_APPS
Define or replace AUTH_USER_MODEL with he new model, as below.
AUTH_USER_MODEL='improved_user.User'
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
To run the test suite on a single version of Django (assuming you have a version of Django installed), run the runtests.py script from the root of the project.
$ python runtests.py
You can limit the tests or pass paramaters as if you had called manage.py test.
$ ./runtests.py tests.test_basic -v 3
To run all linters and test multiple Python and Django versions, use tox.
$ tox
You will need to install Python 3.4, 3.5, and 3.6 on your system for this to work.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-improved-user-0.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32f2e92b40702474439337fdf0c1233e606f5dfe97105e1d565c2d361feed977 |
|
MD5 | 4099e5d9898fc40ac1eac85718d4cb7b |
|
BLAKE2b-256 | a8d7d1637f5cbf54e8b54ca71adee45def2acc6a8591ee58f0a0b9dc1b41210b |
Hashes for django_improved_user-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 719c5362f408c8cbf68989adb89b5e473ec82bb156b6dd1c45638747a213a5de |
|
MD5 | ab1f83d3adfeaead5db9f6f6b168069b |
|
BLAKE2b-256 | e488c0e0fe7d7279d52ba570ee4b4be0a7bdd75cd2d24d32fc76d3e40deed0f6 |