diff --git a/django/contrib/auth/__init__.py b/django/contrib/auth/__init__.py
index d5d4430..0fe0c91 100644
a
|
b
|
def get_user_model():
|
97 | 97 | from django.conf import settings |
98 | 98 | from django.db.models import get_model |
99 | 99 | |
100 | | app_label, model_name = settings.AUTH_USER_MODEL.split('.') |
| 100 | try: |
| 101 | app_label, model_name = settings.AUTH_USER_MODEL.split('.') |
| 102 | except ValueError: |
| 103 | raise ImproperlyConfigured("Invalid AUTH_USER_MODEL setting, value must be of the form 'app_label.model_name'") |
101 | 104 | return get_model(app_label, model_name) |
102 | 105 | |
103 | 106 | |
diff --git a/django/core/management/validation.py b/django/core/management/validation.py
index f613009..190fcb8 100644
a
|
b
|
def get_validation_errors(outfile, app=None):
|
23 | 23 | """ |
24 | 24 | from django.conf import settings |
25 | 25 | from django.db import models, connection |
26 | | from django.db.models.loading import get_app_errors |
| 26 | from django.db.models.loading import get_app_errors, get_model |
27 | 27 | from django.db.models.fields.related import RelatedObject |
28 | 28 | from django.db.models.deletion import SET_NULL, SET_DEFAULT |
29 | 29 | |
… |
… |
def get_validation_errors(outfile, app=None):
|
283 | 283 | if r.get_accessor_name() == rel_query_name: |
284 | 284 | e.add(opts, "Reverse query name for m2m field '%s' clashes with related field '%s.%s'. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.get_accessor_name(), f.name)) |
285 | 285 | |
| 286 | # Check swappable attribute. |
| 287 | if opts.swappable and getattr(settings, opts.swappable, None): |
| 288 | swappable_setting = getattr(settings, opts.swappable) |
| 289 | try: |
| 290 | app_label, model_name = swappable_setting.split('.') |
| 291 | except ValueError: |
| 292 | e.add(opts, "Invalid settings.%s, '%s' not of the form 'app_label.app_name' for swapped out model '%s'." % (opts.swappable, swappable_setting, cls._meta.object_name)) |
| 293 | continue |
| 294 | if get_model(app_label, model_name) not in models.get_models(): |
| 295 | e.add(opts, "'%s' has been swapped out in settings.%s to a model '%s.%s' that does not exist." % (cls._meta.object_name, opts.swappable, app_label, model_name)) |
| 296 | |
286 | 297 | # Check ordering attribute. |
287 | 298 | if opts.ordering: |
288 | 299 | for field_name in opts.ordering: |