Project

General

Profile

Development #6919

Create a custom user model

Added by Benjamin Dauvergne over 4 years ago. Updated over 1 year ago.

Status:
Fermé
Priority:
Haut
Category:
-
Target version:
Start date:
08 Apr 2015
Due date:
% Done:

100%

Patch proposed:
No
Planning:
No

Description

We should return to using a custom user model:
  • username length is 256 chars
  • username is nullable and optional
  • email is 254 chars
  • email default validator is our own
  • User has an automatic uuid field using uuid.uuid4
  • Module fix_user_model.py can be removed
  • Old user models are automatically converted to new custom user model
  • Registration form does not have to generate an uuid username anymore

Associated revisions

Revision 01d6a0c4 (diff)
Added by Benjamin Dauvergne over 4 years ago

Remove support for Django < 1.7 (#6919)

- call plugin initializations in authentic2 application's ready hook
- remove pre-Django-1.7 check before AppConfig classes
- remove pre-Django-1.7 JSON serialization module
- remove south from settings.py
- remove pre-Django-1.7 send_mail support in registration form
- remove pre-Django-1.7 support of TransactionMiddleware in setup.py
- remote pre-Django-1.7 support of the URLValidator validator

Revision 96500dd0 (diff)
Added by Benjamin Dauvergne over 4 years ago

Create a custom user model (fixes #6919)

- Add new model User through a custom user application, Django needs
custom user models to be introduced in the first migration of an
application, it features:
- username length is 256 chars
- username is nullable and optional
- email is 254 chars
- email default validator is our own
- User has an automatic uuid field using uuid.uuid4
- Module fix_user_model.py can be removed
- Old user models are automatically converted to new custom user model
- Registration form does not have to generate an uuid username anymore
- Add migrations to fix foreign key in our own applications and in third
party applications out of our control like django-admin-tools and
django-admin (the AlterField migration operation was overrided for
theses cases)
django.contrib.auth.models.User to authentic2.models.User
- Set AUTH_USER_MODEL to authentic2.User
- Register custome_user.User in admin site
- Remove all monkey patching to Django default user model
- username field is now forced in the model backend, as the
USERNAME_FIELD attribute is now `uuid`.
- Create a local modelform_factory implementation, it specializes User
model by always using authentic2.forms.BaseUserForm as a base class and
add a new parameter `required` which allow to set the required flag on
fields without setting it on the model.
- Add a BaseUserForm base model-form class supporting custom fields
created using the Attribute model.
- Refactor profile editing form, user admin form, manage user edit form
and registrationform using using the new modelform_factory based on the
BaseUserForm class.
- Added new settings:
- A2_USERNAME_IS_UNIQUE: it adds checking that the username attribute
is unique before saving a user object
- A2_REGISTRATION_USERNAME_IS_UNIQUE: it adds checking that the
username attribute is unique before saving a user object; same as
above but only for self-registered users.
- A2_EMAIL_IS_UNIQUE: same as above but for email
- Remove all unused symbols in authentic2.compat: use_attribute_aggregator, get_required_fields and get_registration_fields
-

History

#1 Updated by Benjamin Dauvergne over 4 years ago

  • % Done changed from 0 to 100
  • Status changed from Nouveau to Résolu (à déployer)

#2 Updated by Benjamin Dauvergne over 3 years ago

  • Status changed from Résolu (à déployer) to Solution déployée

#3 Updated by Benjamin Dauvergne over 1 year ago

  • Status changed from Solution déployée to Fermé

Also available in: Atom PDF