Return the User model that is active in this project.
()
| 266 | |
| 267 | |
| 268 | def get_user_model(): |
| 269 | """ |
| 270 | Return the User model that is active in this project. |
| 271 | """ |
| 272 | try: |
| 273 | return django_apps.get_model(settings.AUTH_USER_MODEL, require_ready=False) |
| 274 | except ValueError: |
| 275 | raise ImproperlyConfigured( |
| 276 | "AUTH_USER_MODEL must be of the form 'app_label.model_name'" |
| 277 | ) |
| 278 | except LookupError: |
| 279 | raise ImproperlyConfigured( |
| 280 | "AUTH_USER_MODEL refers to model '%s' that has not been installed" |
| 281 | % settings.AUTH_USER_MODEL |
| 282 | ) |
| 283 | |
| 284 | |
| 285 | def get_user(request): |