mirror of https://github.com/django/django.git
Fixed #21794 -- Adjusted warning for abstract models.
As far as I can tell, they don't need an app_label. Thanks Simon Charette for the report and the review.
This commit is contained in:
parent
8a34d35696
commit
2f65b8e14c
|
@ -104,12 +104,16 @@ class ModelBase(type):
|
|||
# For 'django.contrib.sites.models', this would be 'sites'.
|
||||
# For 'geo.models.places' this would be 'geo'.
|
||||
|
||||
warnings.warn(
|
||||
msg = (
|
||||
"Model class %s.%s doesn't declare an explicit app_label "
|
||||
"and either isn't in an application in INSTALLED_APPS "
|
||||
"or else was imported before its application was loaded. "
|
||||
"This will no longer be supported in Django 1.9."
|
||||
% (module, name), PendingDeprecationWarning, stacklevel=2)
|
||||
"and either isn't in an application in INSTALLED_APPS or "
|
||||
"else was imported before its application was loaded. " %
|
||||
(module, name))
|
||||
if abstract:
|
||||
msg += "Its app_label will be set to None in Django 1.9."
|
||||
else:
|
||||
msg += "This will no longer be supported in Django 1.9."
|
||||
warnings.warn(msg, PendingDeprecationWarning, stacklevel=2)
|
||||
|
||||
model_module = sys.modules[new_class.__module__]
|
||||
package_components = model_module.__name__.split('.')
|
||||
|
|
Loading…
Reference in New Issue