Ticket #21794: 0001-Don-t-warn-about-missing-app_label-for-abstract-mode.patch

File 0001-Don-t-warn-about-missing-app_label-for-abstract-mode.patch, 1.7 KB (added by Simon Charette, 11 years ago)
  • django/db/models/base.py

    From c763f4c38ce918a822a0b5afb2ec0f3bfeb53669 Mon Sep 17 00:00:00 2001
    From: Simon Charette <charette.s@gmail.com>
    Date: Thu, 16 Jan 2014 22:20:03 -0500
    Subject: [PATCH] Don't warn about missing `app_label` for abstract models.
    
    ---
     django/db/models/base.py | 15 +++++++++------
     1 file changed, 9 insertions(+), 6 deletions(-)
    
    diff --git a/django/db/models/base.py b/django/db/models/base.py
    index d7b54b9..6670781 100644
    a b class ModelBase(type):  
    104104                # For 'django.contrib.sites.models', this would be 'sites'.
    105105                # For 'geo.models.places' this would be 'geo'.
    106106
    107                 warnings.warn(
    108                     "Model class %s.%s doesn't declare an explicit app_label "
    109                     "and either isn't in an application in  INSTALLED_APPS "
    110                     "or else was imported before its application was loaded. "
    111                     "This will no longer be supported in Django 1.9."
    112                     % (module, name), PendingDeprecationWarning, stacklevel=2)
     107                if not abstract:
     108                    warnings.warn(
     109                        "Model class %s.%s doesn't declare an explicit "
     110                        "app_label and either isn't in an application in "
     111                        "INSTALLED_APPS or else was imported before its "
     112                        "application was loaded. This will no longer be "
     113                        "supported in Django 1.9." % (module, name),
     114                        PendingDeprecationWarning, stacklevel=2
     115                    )
    113116
    114117                model_module = sys.modules[new_class.__module__]
    115118                package_components = model_module.__name__.split('.')
Back to Top