blender-studio/users/apps.py
Anna Sirota e7669f6e8c Move Profile fields into a custom User model [D9913]
- Moves all columns of `Profile` model to the custom `users.User` model;
- Moves `Notification` model to `users` app without touching its table's content;
- Unifies `Profile`/`User` admin;
- Moves/renames a lot of modules and templates;
- Makes email lookup in unsubscribe handler case-insensitive (bugfix).

- Having all custom profile data on `User` makes it easy to use it:
   Every template/module that needs to do something with profile data has to reference it with `[request].user.profile.field`, potentially introducing extra joins, requiring extra checks and so on;
- Having all custom profile data on `User` makes implementing deletion more straightforward, if not simpler:
   The only way to reliably override the way `User` records are deleted is to override methods of the model/queryset, which is not possible while it's governed by Django's `auth` app. Having User and Profile separate also introduces a layer of hacks in the admin, which we could do without.
2020-12-22 10:28:57 +01:00

16 lines
372 B
Python

from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
verbose_name = 'Authentication and authorization'
def ready(self) -> None:
import users.signals # noqa: F401
from actstream import registry
from django.contrib.auth import get_user_model
User = get_user_model()
registry.register(User)