diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-12-21 14:21:25 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-12-22 13:26:30 +0100 |
| commit | 8b2a30f6f16cb1f3538847954030d69da005bc7f (patch) | |
| tree | 130ac74131cc6bb7625d6805ddd99c41dc55e5f6 /django/apps/config.py | |
| parent | 110001d0bbbabe2a5b57b14a59bd0e4b71bf2712 (diff) | |
Fixed #32285 -- Raised ImproperlyConfigured when AppConfig.label is not a valid Python identifier.
Diffstat (limited to 'django/apps/config.py')
| -rw-r--r-- | django/apps/config.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/apps/config.py b/django/apps/config.py index 6d794eee3a..bced53d506 100644 --- a/django/apps/config.py +++ b/django/apps/config.py @@ -34,6 +34,10 @@ class AppConfig: # This value must be unique across a Django project. if not hasattr(self, 'label'): self.label = app_name.rpartition(".")[2] + if not self.label.isidentifier(): + raise ImproperlyConfigured( + "The app label '%s' is not a valid Python identifier." % self.label + ) # Human-readable name for the application e.g. "Admin". if not hasattr(self, 'verbose_name'): |
