mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Renamed RemovedInDjangoXYWarnings for new roadmap.
Forwardport of ae1d663b79
from stable/1.8.x plus more.
This commit is contained in:
parent
e73842a95f
commit
aaacaeb096
@ -13,7 +13,7 @@ import warnings
|
||||
|
||||
from django.conf import global_settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.functional import LazyObject, empty
|
||||
|
||||
ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
|
||||
@ -114,11 +114,11 @@ class Settings(BaseSettings):
|
||||
if ('django.contrib.auth.middleware.AuthenticationMiddleware' in self.MIDDLEWARE_CLASSES and
|
||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware' not in self.MIDDLEWARE_CLASSES):
|
||||
warnings.warn(
|
||||
"Session verification will become mandatory in Django 2.0. "
|
||||
"Session verification will become mandatory in Django 1.10. "
|
||||
"Please add 'django.contrib.auth.middleware.SessionAuthenticationMiddleware' "
|
||||
"to your MIDDLEWARE_CLASSES setting when you are ready to opt-in after "
|
||||
"reading the upgrade considerations in the 1.8 release notes.",
|
||||
RemovedInDjango20Warning
|
||||
RemovedInDjango110Warning
|
||||
)
|
||||
|
||||
if hasattr(time, 'tzset') and self.TIME_ZONE:
|
||||
|
@ -5,8 +5,9 @@ from django.core.urlresolvers import (RegexURLPattern,
|
||||
RegexURLResolver, LocaleRegexURLResolver)
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning, RemovedInDjango21Warning
|
||||
|
||||
from django.utils.deprecation import (
|
||||
RemovedInDjango20Warning, RemovedInDjango110Warning,
|
||||
)
|
||||
|
||||
__all__ = ['handler400', 'handler403', 'handler404', 'handler500', 'include', 'patterns', 'url']
|
||||
|
||||
@ -23,7 +24,7 @@ def include(arg, namespace=None, app_name=None):
|
||||
warnings.warn(
|
||||
'The app_name argument to django.conf.urls.include() is deprecated. '
|
||||
'Set the app_name in the included URLconf instead.',
|
||||
RemovedInDjango21Warning, stacklevel=2
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
)
|
||||
|
||||
if isinstance(arg, tuple):
|
||||
@ -39,7 +40,7 @@ def include(arg, namespace=None, app_name=None):
|
||||
'Passing a 3-tuple to django.conf.urls.include() is deprecated. '
|
||||
'Pass a 2-tuple containing the list of patterns and app_name, '
|
||||
'and provide the namespace argument to include() instead.',
|
||||
RemovedInDjango21Warning, stacklevel=2
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
)
|
||||
urlconf_module, app_name, namespace = arg
|
||||
else:
|
||||
@ -56,7 +57,7 @@ def include(arg, namespace=None, app_name=None):
|
||||
'providing an app_name is deprecated. Set the app_name attribute '
|
||||
'in the included module, or pass a 2-tuple containing the list of '
|
||||
'patterns and app_name instead.',
|
||||
RemovedInDjango21Warning, stacklevel=2
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
)
|
||||
|
||||
namespace = namespace or app_name
|
||||
@ -77,9 +78,9 @@ def include(arg, namespace=None, app_name=None):
|
||||
def patterns(prefix, *args):
|
||||
warnings.warn(
|
||||
'django.conf.urls.patterns() is deprecated and will be removed in '
|
||||
'Django 2.0. Update your urlpatterns to be a list of '
|
||||
'Django 1.10. Update your urlpatterns to be a list of '
|
||||
'django.conf.urls.url() instances instead.',
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
pattern_list = []
|
||||
for t in args:
|
||||
@ -100,9 +101,9 @@ def url(regex, view, kwargs=None, name=None, prefix=''):
|
||||
if isinstance(view, six.string_types):
|
||||
warnings.warn(
|
||||
'Support for string view arguments to url() is deprecated and '
|
||||
'will be removed in Django 2.0 (got %s). Pass the callable '
|
||||
'will be removed in Django 1.10 (got %s). Pass the callable '
|
||||
'instead.' % view,
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
if not view:
|
||||
raise ImproperlyConfigured('Empty URL pattern view name not permitted (for pattern %r)' % regex)
|
||||
|
@ -4,7 +4,7 @@ from django.conf import settings
|
||||
from django.conf.urls import patterns, url
|
||||
from django.core.urlresolvers import LocaleRegexURLResolver
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.views.i18n import set_language
|
||||
|
||||
|
||||
@ -18,9 +18,9 @@ def i18n_patterns(prefix, *args):
|
||||
warnings.warn(
|
||||
"Calling i18n_patterns() with the `prefix` argument and with tuples "
|
||||
"instead of django.conf.urls.url() instances is deprecated and "
|
||||
"will no longer work in Django 2.0. Use a list of "
|
||||
"will no longer work in Django 1.10. Use a list of "
|
||||
"django.conf.urls.url() instances instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
pattern_list = patterns(prefix, *args)
|
||||
else:
|
||||
|
@ -14,7 +14,7 @@ from django.db.models.fields.related import ManyToManyRel
|
||||
from django.forms.utils import flatatt
|
||||
from django.template.defaultfilters import capfirst, linebreaksbr
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text, smart_text
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.html import conditional_escape, format_html
|
||||
@ -285,9 +285,9 @@ class InlineAdminForm(AdminForm):
|
||||
def original_content_type_id(self):
|
||||
warnings.warn(
|
||||
'InlineAdminForm.original_content_type_id is deprecated and will be '
|
||||
'removed in Django 2.0. If you were using this attribute to construct '
|
||||
'removed in Django 1.10. If you were using this attribute to construct '
|
||||
'the "view on site" URL, use the `absolute_url` attribute instead.',
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
if self.original is not None:
|
||||
# Since this module gets imported in the application's root package,
|
||||
|
@ -2,7 +2,7 @@ import warnings
|
||||
from unittest import skipIf
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
|
||||
def skipIfCustomUser(test_func):
|
||||
@ -11,6 +11,6 @@ def skipIfCustomUser(test_func):
|
||||
"""
|
||||
warnings.warn(
|
||||
"django.contrib.auth.tests.utils.skipIfCustomUser is deprecated.",
|
||||
RemovedInDjango21Warning, stacklevel=2)
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
|
||||
return skipIf(settings.AUTH_USER_MODEL != 'auth.User', 'Custom user model in use')(test_func)
|
||||
|
@ -16,7 +16,7 @@ from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect, QueryDict
|
||||
from django.shortcuts import resolve_url
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.http import is_safe_url, urlsafe_base64_decode
|
||||
from django.utils.six.moves.urllib.parse import urlparse, urlunparse
|
||||
@ -175,8 +175,8 @@ def password_reset(request, is_admin_site=False,
|
||||
warnings.warn(
|
||||
"The is_admin_site argument to "
|
||||
"django.contrib.auth.views.password_reset() is deprecated "
|
||||
"and will be removed in Django 2.0.",
|
||||
RemovedInDjango20Warning, 3
|
||||
"and will be removed in Django 1.10.",
|
||||
RemovedInDjango110Warning, 3
|
||||
)
|
||||
opts = dict(opts, domain_override=request.get_host())
|
||||
form.save(**opts)
|
||||
|
@ -5,7 +5,7 @@ import warnings
|
||||
from django.apps import apps
|
||||
from django.db import models
|
||||
from django.db.utils import IntegrityError, OperationalError, ProgrammingError
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
@ -41,7 +41,7 @@ class ContentTypeManager(models.Manager):
|
||||
del kwargs['name']
|
||||
warnings.warn(
|
||||
"ContentType.name field doesn't exist any longer. Please remove it from your code.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
return super(ContentTypeManager, self).create(**kwargs)
|
||||
|
||||
def get_for_model(self, model, for_concrete_model=True):
|
||||
|
@ -2,7 +2,7 @@ import warnings
|
||||
|
||||
from django.contrib.gis.db.models.query import GeoQuerySet
|
||||
from django.db.models.manager import Manager
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
|
||||
class GeoManager(Manager.from_queryset(GeoQuerySet)):
|
||||
@ -17,6 +17,6 @@ class GeoManager(Manager.from_queryset(GeoQuerySet)):
|
||||
warnings.warn(
|
||||
"The GeoManager class is deprecated. Simply use a normal manager "
|
||||
"once you have replaced all calls to GeoQuerySet methods by annotations.",
|
||||
RemovedInDjango21Warning, stacklevel=2
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
)
|
||||
super(GeoManager, self).__init__(*args, **kwargs)
|
||||
|
@ -16,7 +16,7 @@ from django.db.models.fields import Field
|
||||
from django.db.models.query import QuerySet
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import (
|
||||
RemovedInDjango20Warning, RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning, RemovedInDjango110Warning,
|
||||
)
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ class GeoQuerySet(QuerySet):
|
||||
warnings.warn(
|
||||
"The collect GeoQuerySet method is deprecated. Use the Collect() "
|
||||
"aggregate in an aggregate() or annotate() method.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
return self._spatial_aggregate(aggregates.Collect, **kwargs)
|
||||
|
||||
@ -116,7 +116,7 @@ class GeoQuerySet(QuerySet):
|
||||
warnings.warn(
|
||||
"The extent GeoQuerySet method is deprecated. Use the Extent() "
|
||||
"aggregate in an aggregate() or annotate() method.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
return self._spatial_aggregate(aggregates.Extent, **kwargs)
|
||||
|
||||
@ -129,7 +129,7 @@ class GeoQuerySet(QuerySet):
|
||||
warnings.warn(
|
||||
"The extent3d GeoQuerySet method is deprecated. Use the Extent3D() "
|
||||
"aggregate in an aggregate() or annotate() method.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
return self._spatial_aggregate(aggregates.Extent3D, **kwargs)
|
||||
|
||||
@ -236,7 +236,7 @@ class GeoQuerySet(QuerySet):
|
||||
warnings.warn(
|
||||
"The make_line GeoQuerySet method is deprecated. Use the MakeLine() "
|
||||
"aggregate in an aggregate() or annotate() method.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
return self._spatial_aggregate(aggregates.MakeLine, geo_field_type=PointField, **kwargs)
|
||||
|
||||
@ -424,7 +424,7 @@ class GeoQuerySet(QuerySet):
|
||||
warnings.warn(
|
||||
"The unionagg GeoQuerySet method is deprecated. Use the Union() "
|
||||
"aggregate in an aggregate() or annotate() method.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
return self._spatial_aggregate(aggregates.Union, **kwargs)
|
||||
|
||||
@ -518,7 +518,7 @@ class GeoQuerySet(QuerySet):
|
||||
warnings.warn(
|
||||
"The %s GeoQuerySet method is deprecated. See GeoDjango Functions "
|
||||
"documentation to find the expression-based replacement." % att,
|
||||
RemovedInDjango21Warning, stacklevel=2
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
)
|
||||
# Default settings.
|
||||
settings.setdefault('desc', None)
|
||||
|
@ -7,4 +7,4 @@ __all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'] + aggregates.__
|
||||
warnings.warn(
|
||||
"django.contrib.gis.db.models.sql.aggregates is deprecated. Use "
|
||||
"django.contrib.gis.db.models.aggregates instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
|
@ -1,11 +1,11 @@
|
||||
import warnings
|
||||
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
default_app_config = 'django.contrib.webdesign.apps.WebDesignConfig'
|
||||
|
||||
warnings.warn(
|
||||
"django.contrib.webdesign will be removed in Django 2.0. The "
|
||||
"django.contrib.webdesign will be removed in Django 1.10. The "
|
||||
"{% lorem %} tag is now included in the built-in tags.",
|
||||
RemovedInDjango20Warning
|
||||
RemovedInDjango110Warning
|
||||
)
|
||||
|
@ -1,9 +1,9 @@
|
||||
import warnings
|
||||
|
||||
from django.template.context_processors import * # NOQA
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
warnings.warn(
|
||||
"django.core.context_processors is deprecated in favor of "
|
||||
"django.template.context_processors.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
|
@ -10,7 +10,7 @@ from django.core.files.move import file_move_safe
|
||||
from django.utils._os import abspathu, safe_join
|
||||
from django.utils.crypto import get_random_string
|
||||
from django.utils.deconstruct import deconstructible
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import filepath_to_uri, force_text
|
||||
from django.utils.functional import LazyObject
|
||||
from django.utils.inspect import func_supports_parameter
|
||||
@ -55,8 +55,8 @@ class Storage(object):
|
||||
warnings.warn(
|
||||
'Backwards compatibility for storage backends without '
|
||||
'support for the `max_length` argument in '
|
||||
'Storage.get_available_name() will be removed in Django 2.0.',
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
'Storage.get_available_name() will be removed in Django 1.10.',
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
name = self.get_available_name(name)
|
||||
|
||||
|
@ -14,7 +14,7 @@ from django.core.exceptions import (
|
||||
from django.db import connections, transaction
|
||||
from django.http.multipartparser import MultiPartParserError
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.module_loading import import_string
|
||||
from django.views import debug
|
||||
@ -93,8 +93,8 @@ class BaseHandler(object):
|
||||
except TypeError:
|
||||
warnings.warn(
|
||||
"Error handlers should accept an exception parameter. Update "
|
||||
"your code as this parameter will be required in Django 2.1",
|
||||
RemovedInDjango21Warning, stacklevel=2
|
||||
"your code as this parameter will be required in Django 2.0",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
)
|
||||
response = callback(request, **param_dict)
|
||||
except:
|
||||
|
@ -15,7 +15,7 @@ import django
|
||||
from django.core import checks
|
||||
from django.core.management.color import color_style, no_style
|
||||
from django.db import connections
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_str
|
||||
|
||||
|
||||
@ -170,7 +170,7 @@ class BaseCommand(object):
|
||||
``option_list``
|
||||
This is the list of ``optparse`` options which will be fed
|
||||
into the command's ``OptionParser`` for parsing arguments.
|
||||
Deprecated and will be removed in Django 2.0.
|
||||
Deprecated and will be removed in Django 1.10.
|
||||
|
||||
``output_transaction``
|
||||
A boolean indicating whether the command outputs SQL
|
||||
@ -263,7 +263,7 @@ class BaseCommand(object):
|
||||
# Backwards compatibility: use deprecated optparse module
|
||||
warnings.warn("OptionParser usage for Django management commands "
|
||||
"is deprecated, use ArgumentParser instead",
|
||||
RemovedInDjango20Warning)
|
||||
RemovedInDjango110Warning)
|
||||
parser = OptionParser(prog=prog_name,
|
||||
usage=self.usage(subcommand),
|
||||
version=self.get_version())
|
||||
@ -578,9 +578,9 @@ class NoArgsCommand(BaseCommand):
|
||||
|
||||
def __init__(self):
|
||||
warnings.warn(
|
||||
"NoArgsCommand class is deprecated and will be removed in Django 2.0. "
|
||||
"NoArgsCommand class is deprecated and will be removed in Django 1.10. "
|
||||
"Use BaseCommand instead, which takes no arguments by default.",
|
||||
RemovedInDjango20Warning
|
||||
RemovedInDjango110Warning
|
||||
)
|
||||
super(NoArgsCommand, self).__init__()
|
||||
|
||||
|
@ -17,7 +17,7 @@ from django.db.migrations.autodetector import MigrationAutodetector
|
||||
from django.db.migrations.executor import MigrationExecutor
|
||||
from django.db.migrations.loader import AmbiguityError
|
||||
from django.db.migrations.state import ProjectState
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.module_loading import module_has_submodule
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ class Command(BaseCommand):
|
||||
if options.get("list", False):
|
||||
warnings.warn(
|
||||
"The 'migrate --list' command is deprecated. Use 'showmigrations' instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
self.stdout.ending = None # Remove when #21429 is fixed
|
||||
return call_command(
|
||||
'showmigrations',
|
||||
|
@ -18,7 +18,7 @@ from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
|
||||
from django.http import Http404
|
||||
from django.utils import lru_cache, six
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_str, force_text, iri_to_uri
|
||||
from django.utils.functional import cached_property, lazy
|
||||
from django.utils.http import RFC3986_SUBDELIMS, urlquote
|
||||
@ -459,7 +459,7 @@ class RegexURLResolver(LocaleRegexProvider):
|
||||
if not callable(original_lookup) and callable(lookup_view):
|
||||
warnings.warn(
|
||||
'Reversing by dotted path is deprecated (%s).' % original_lookup,
|
||||
RemovedInDjango20Warning, stacklevel=3
|
||||
RemovedInDjango110Warning, stacklevel=3
|
||||
)
|
||||
possibilities = self.reverse_dict.getlist(lookup_view)
|
||||
|
||||
|
@ -8,7 +8,7 @@ from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db.backends import utils
|
||||
from django.utils import six, timezone
|
||||
from django.utils.dateparse import parse_duration
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
|
||||
@ -559,7 +559,7 @@ class BaseDatabaseOperations(object):
|
||||
warnings.warn(
|
||||
"check_aggregate_support has been deprecated. Use "
|
||||
"check_expression_support instead.",
|
||||
RemovedInDjango21Warning, stacklevel=2)
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
return self.check_expression_support(aggregate_func)
|
||||
|
||||
def check_expression_support(self, expression):
|
||||
|
@ -16,7 +16,7 @@ from django.db import utils
|
||||
from django.db.backends import utils as backend_utils
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.utils import six, timezone
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.safestring import SafeBytes, SafeText
|
||||
@ -54,13 +54,13 @@ IntegrityError = Database.IntegrityError
|
||||
|
||||
|
||||
def adapt_datetime_warn_on_aware_datetime(value, conv):
|
||||
# Remove this function and rely on the default adapter in Django 2.1.
|
||||
# Remove this function and rely on the default adapter in Django 2.0.
|
||||
if settings.USE_TZ and timezone.is_aware(value):
|
||||
warnings.warn(
|
||||
"The MySQL database adapter received an aware datetime (%s), "
|
||||
"probably from cursor.execute(). Update your code to pass a "
|
||||
"naive datetime in the database connection's time zone (UTC by "
|
||||
"default).", RemovedInDjango21Warning)
|
||||
"default).", RemovedInDjango20Warning)
|
||||
# This doesn't account for the database connection's timezone,
|
||||
# which isn't known. (That's why this adapter is deprecated.)
|
||||
value = value.astimezone(timezone.utc).replace(tzinfo=None)
|
||||
|
@ -17,7 +17,7 @@ from django.db import utils
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.backends.base.validation import BaseDatabaseValidation
|
||||
from django.utils import six, timezone
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.duration import duration_string
|
||||
from django.utils.encoding import force_bytes, force_text
|
||||
from django.utils.functional import cached_property
|
||||
@ -342,7 +342,7 @@ class OracleParam(object):
|
||||
"The Oracle database adapter received an aware datetime (%s), "
|
||||
"probably from cursor.execute(). Update your code to pass a "
|
||||
"naive datetime in the database connection's time zone (UTC by "
|
||||
"default).", RemovedInDjango21Warning)
|
||||
"default).", RemovedInDjango20Warning)
|
||||
param = param.astimezone(timezone.utc).replace(tzinfo=None)
|
||||
param = Oracle_datetime.from_datetime(param)
|
||||
|
||||
|
@ -20,7 +20,7 @@ from django.utils import six, timezone
|
||||
from django.utils.dateparse import (
|
||||
parse_date, parse_datetime, parse_duration, parse_time,
|
||||
)
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.safestring import SafeBytes
|
||||
|
||||
@ -51,13 +51,13 @@ IntegrityError = Database.IntegrityError
|
||||
|
||||
|
||||
def adapt_datetime_warn_on_aware_datetime(value):
|
||||
# Remove this function and rely on the default adapter in Django 2.1.
|
||||
# Remove this function and rely on the default adapter in Django 2.0.
|
||||
if settings.USE_TZ and timezone.is_aware(value):
|
||||
warnings.warn(
|
||||
"The SQLite database adapter received an aware datetime (%s), "
|
||||
"probably from cursor.execute(). Update your code to pass a "
|
||||
"naive datetime in the database connection's time zone (UTC by "
|
||||
"default).", RemovedInDjango21Warning)
|
||||
"default).", RemovedInDjango20Warning)
|
||||
# This doesn't account for the database connection's timezone,
|
||||
# which isn't known. (That's why this adapter is deprecated.)
|
||||
value = value.astimezone(timezone.utc).replace(tzinfo=None)
|
||||
|
@ -41,7 +41,7 @@ class Aggregate(Func):
|
||||
def _patch_aggregate(self, query):
|
||||
"""
|
||||
Helper method for patching 3rd party aggregates that do not yet support
|
||||
the new way of subclassing. This method should be removed in 2.0
|
||||
the new way of subclassing. This method will be removed in Django 1.10.
|
||||
|
||||
add_to_query(query, alias, col, source, is_summary) will be defined on
|
||||
legacy aggregates which, in turn, instantiates the SQL implementation of
|
||||
|
@ -24,7 +24,7 @@ from django.utils.duration import duration_string
|
||||
from django.utils.functional import cached_property, curry, Promise
|
||||
from django.utils.text import capfirst
|
||||
from django.utils import timezone
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.encoding import (smart_text, force_text, force_bytes,
|
||||
python_2_unicode_compatible)
|
||||
@ -246,7 +246,7 @@ class Field(RegisterLookupMixin):
|
||||
def rel(self):
|
||||
warnings.warn(
|
||||
"Usage of field.rel has been deprecated. Use field.remote_field instead.",
|
||||
RemovedInDjango21Warning, 2)
|
||||
RemovedInDjango20Warning, 2)
|
||||
return self.remote_field
|
||||
|
||||
def _check_choices(self):
|
||||
|
@ -10,7 +10,7 @@ from django.core.files.storage import default_storage
|
||||
from django.db.models import signals
|
||||
from django.db.models.fields import Field
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_str, force_text
|
||||
from django.utils.inspect import func_supports_parameter
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
@ -95,8 +95,8 @@ class FieldFile(File):
|
||||
warnings.warn(
|
||||
'Backwards compatibility for storage backends without '
|
||||
'support for the `max_length` argument in '
|
||||
'Storage.save() will be removed in Django 2.0.',
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
'Storage.save() will be removed in Django 1.10.',
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
self.name = self.storage.save(name, content)
|
||||
|
||||
|
@ -25,7 +25,7 @@ from django.db.models.query_utils import PathInfo
|
||||
from django.db.models.utils import make_model_tuple
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import (
|
||||
RemovedInDjango20Warning, RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning, RemovedInDjango110Warning,
|
||||
)
|
||||
from django.utils.encoding import force_text, smart_text
|
||||
from django.utils.functional import cached_property, curry
|
||||
@ -84,7 +84,7 @@ def add_lazy_relation(cls, field, relation, operation):
|
||||
warnings.warn(
|
||||
"add_lazy_relation() has been superseded by lazy_related_operation() "
|
||||
"and related methods on the Apps class.",
|
||||
RemovedInDjango21Warning, stacklevel=2)
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
# Rearrange args for new Apps.lazy_model_operation
|
||||
function = lambda local, related, field: operation(field, related, local)
|
||||
lazy_related_operation(function, cls, relation, field=field)
|
||||
@ -328,7 +328,7 @@ class RelatedField(Field):
|
||||
def related(self):
|
||||
warnings.warn(
|
||||
"Usage of field.related has been deprecated. Use field.remote_field instead.",
|
||||
RemovedInDjango20Warning, 2)
|
||||
RemovedInDjango110Warning, 2)
|
||||
return self.remote_field
|
||||
|
||||
def do_related_class(self, other, cls):
|
||||
@ -1306,7 +1306,7 @@ class ForeignObjectRel(object):
|
||||
warnings.warn(
|
||||
"Usage of ForeignObjectRel.to attribute has been deprecated. "
|
||||
"Use the model attribute instead.",
|
||||
RemovedInDjango21Warning, 2)
|
||||
RemovedInDjango20Warning, 2)
|
||||
return self.model
|
||||
|
||||
@cached_property
|
||||
|
@ -9,7 +9,7 @@ seamlessly.
|
||||
|
||||
import warnings
|
||||
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
|
||||
class SubfieldBase(type):
|
||||
@ -19,7 +19,7 @@ class SubfieldBase(type):
|
||||
"""
|
||||
def __new__(cls, name, bases, attrs):
|
||||
warnings.warn("SubfieldBase has been deprecated. Use Field.from_db_value instead.",
|
||||
RemovedInDjango20Warning)
|
||||
RemovedInDjango110Warning)
|
||||
|
||||
new_class = super(SubfieldBase, cls).__new__(cls, name, bases, attrs)
|
||||
new_class.contribute_to_class = make_contrib(
|
||||
|
@ -14,7 +14,7 @@ from django.db.models.fields.proxy import OrderWrt
|
||||
from django.db.models.fields.related import ManyToManyField
|
||||
from django.utils import six
|
||||
from django.utils.datastructures import ImmutableList, OrderedSet
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import (
|
||||
force_text, python_2_unicode_compatible, smart_text,
|
||||
)
|
||||
@ -53,7 +53,7 @@ class raise_deprecation(object):
|
||||
fn.__name__,
|
||||
self.suggested_alternative,
|
||||
),
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
return fn(*args, **kwargs)
|
||||
return wrapper
|
||||
@ -537,7 +537,7 @@ class Options(object):
|
||||
only forward fields will be returned.
|
||||
|
||||
The many_to_many argument exists for backwards compatibility reasons;
|
||||
it has been deprecated and will be removed in Django 2.0.
|
||||
it has been deprecated and will be removed in Django 1.10.
|
||||
"""
|
||||
m2m_in_kwargs = many_to_many is not None
|
||||
if m2m_in_kwargs:
|
||||
@ -546,7 +546,7 @@ class Options(object):
|
||||
warnings.warn(
|
||||
"The 'many_to_many' argument on get_field() is deprecated; "
|
||||
"use a filter on field.many_to_many instead.",
|
||||
RemovedInDjango20Warning
|
||||
RemovedInDjango110Warning
|
||||
)
|
||||
|
||||
try:
|
||||
|
@ -6,7 +6,7 @@ import warnings
|
||||
|
||||
from django.db.models.fields import FloatField, IntegerField
|
||||
from django.db.models.lookups import RegisterLookupMixin
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
__all__ = ['Aggregate', 'Avg', 'Count', 'Max', 'Min', 'StdDev', 'Sum', 'Variance']
|
||||
@ -15,7 +15,7 @@ __all__ = ['Aggregate', 'Avg', 'Count', 'Max', 'Min', 'StdDev', 'Sum', 'Variance
|
||||
warnings.warn(
|
||||
"django.db.models.sql.aggregates is deprecated. Use "
|
||||
"django.db.models.aggregates instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
|
||||
|
||||
class Aggregate(RegisterLookupMixin):
|
||||
|
@ -13,7 +13,7 @@ from django.db.models.sql.datastructures import EmptyResultSet
|
||||
from django.db.models.sql.query import Query, get_order_dir
|
||||
from django.db.transaction import TransactionManagementError
|
||||
from django.db.utils import DatabaseError
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.six.moves import zip
|
||||
|
||||
|
||||
@ -338,7 +338,7 @@ class SQLCompiler(object):
|
||||
warnings.warn(
|
||||
"Calling a SQLCompiler directly is deprecated. "
|
||||
"Call compiler.quote_name_unless_alias instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
return self.quote_name_unless_alias(name)
|
||||
|
||||
def quote_name_unless_alias(self, name):
|
||||
|
@ -29,7 +29,7 @@ from django.db.models.sql.where import (
|
||||
AND, OR, ExtraWhere, NothingNode, WhereNode,
|
||||
)
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.tree import Node
|
||||
|
||||
@ -216,7 +216,7 @@ class Query(object):
|
||||
def aggregates(self):
|
||||
warnings.warn(
|
||||
"The aggregates property is deprecated. Use annotations instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
return self.annotations
|
||||
|
||||
def __str__(self):
|
||||
@ -973,7 +973,7 @@ class Query(object):
|
||||
def add_aggregate(self, aggregate, model, alias, is_summary):
|
||||
warnings.warn(
|
||||
"add_aggregate() is deprecated. Use add_annotation() instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
self.add_annotation(aggregate, alias, is_summary)
|
||||
|
||||
def add_annotation(self, annotation, alias, is_summary=False):
|
||||
@ -1806,7 +1806,7 @@ class Query(object):
|
||||
def set_aggregate_mask(self, names):
|
||||
warnings.warn(
|
||||
"set_aggregate_mask() is deprecated. Use set_annotation_mask() instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
self.set_annotation_mask(names)
|
||||
|
||||
def set_annotation_mask(self, names):
|
||||
@ -1820,7 +1820,7 @@ class Query(object):
|
||||
def append_aggregate_mask(self, names):
|
||||
warnings.warn(
|
||||
"append_aggregate_mask() is deprecated. Use append_annotation_mask() instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
self.append_annotation_mask(names)
|
||||
|
||||
def append_annotation_mask(self, names):
|
||||
@ -1863,7 +1863,7 @@ class Query(object):
|
||||
def aggregate_select(self):
|
||||
warnings.warn(
|
||||
"aggregate_select() is deprecated. Use annotation_select() instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
return self.annotation_select
|
||||
|
||||
@property
|
||||
|
@ -9,7 +9,7 @@ from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils import six
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.module_loading import import_string
|
||||
|
||||
@ -304,8 +304,8 @@ class ConnectionRouter(object):
|
||||
"The signature of allow_migrate has changed from "
|
||||
"allow_migrate(self, db, model) to "
|
||||
"allow_migrate(self, db, app_label, model_name=None, **hints). "
|
||||
"Support for the old signature will be removed in Django 2.0.",
|
||||
RemovedInDjango20Warning)
|
||||
"Support for the old signature will be removed in Django 1.10.",
|
||||
RemovedInDjango110Warning)
|
||||
model = hints.get('model')
|
||||
allow = None if model is None else method(db, model)
|
||||
else:
|
||||
|
@ -4,7 +4,7 @@ import warnings
|
||||
import weakref
|
||||
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.inspect import func_accepts_kwargs
|
||||
from django.utils.six.moves import range
|
||||
|
||||
@ -145,7 +145,7 @@ class Signal(object):
|
||||
"""
|
||||
if weak is not None:
|
||||
warnings.warn("Passing `weak` to disconnect has no effect.",
|
||||
RemovedInDjango21Warning, stacklevel=2)
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
if dispatch_uid:
|
||||
lookup_key = (dispatch_uid, _make_id(sender))
|
||||
else:
|
||||
|
@ -1,7 +1,7 @@
|
||||
import warnings
|
||||
|
||||
from django.forms.widgets import SelectDateWidget
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
__all__ = ['SelectDateWidget']
|
||||
|
||||
@ -9,4 +9,4 @@ __all__ = ['SelectDateWidget']
|
||||
warnings.warn(
|
||||
"django.forms.extras is deprecated. You can find "
|
||||
"SelectDateWidget in django.forms.widgets instead.",
|
||||
RemovedInDjango21Warning, stacklevel=2)
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
|
@ -29,7 +29,7 @@ from django.forms.widgets import (
|
||||
from django.utils import formats, six
|
||||
from django.utils.dateparse import parse_duration
|
||||
from django.utils.deprecation import (
|
||||
RemovedInDjango20Warning, RenameMethodsBase,
|
||||
RemovedInDjango110Warning, RenameMethodsBase,
|
||||
)
|
||||
from django.utils.duration import duration_string
|
||||
from django.utils.encoding import force_str, force_text, smart_text
|
||||
@ -50,7 +50,7 @@ __all__ = (
|
||||
|
||||
class RenameFieldMethods(RenameMethodsBase):
|
||||
renamed_methods = (
|
||||
('_has_changed', 'has_changed', RemovedInDjango20Warning),
|
||||
('_has_changed', 'has_changed', RemovedInDjango110Warning),
|
||||
)
|
||||
|
||||
|
||||
@ -544,7 +544,7 @@ class RegexField(CharField):
|
||||
warnings.warn(
|
||||
"The 'error_message' argument is deprecated. Use "
|
||||
"Field.error_messages['invalid'] instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
error_messages = kwargs.get('error_messages') or {}
|
||||
error_messages['invalid'] = error_message
|
||||
|
@ -19,7 +19,7 @@ from django.template.engine import (
|
||||
_context_instance_undefined, _dictionary_undefined, _dirs_undefined,
|
||||
)
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.functional import Promise
|
||||
|
||||
@ -62,7 +62,7 @@ def render(request, template_name, context=None,
|
||||
and dirs is _dirs_undefined
|
||||
and dictionary is _dictionary_undefined):
|
||||
# No deprecated arguments were passed - use the new code path
|
||||
# In Django 2.0, request should become a positional argument.
|
||||
# In Django 1.10, request should become a positional argument.
|
||||
content = loader.render_to_string(
|
||||
template_name, context, request=request, using=using)
|
||||
|
||||
@ -78,7 +78,7 @@ def render(request, template_name, context=None,
|
||||
warnings.warn(
|
||||
"The current_app argument of render is deprecated. "
|
||||
"Set the current_app attribute of request instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
request.current_app = current_app
|
||||
# Directly set the private attribute to avoid triggering the
|
||||
# warning in RequestContext.__init__.
|
||||
|
@ -62,7 +62,7 @@ from .exceptions import TemplateDoesNotExist, TemplateSyntaxError # NOQA
|
||||
from .base import (Context, Node, NodeList, Origin, RequestContext, # NOQA
|
||||
Template, Variable)
|
||||
|
||||
# Deprecated in Django 1.8, will be removed in Django 2.0.
|
||||
# Deprecated in Django 1.8, will be removed in Django 1.10.
|
||||
from .base import resolve_variable # NOQA
|
||||
|
||||
# Library management
|
||||
|
@ -13,7 +13,7 @@ from django.template.context import Context, RequestContext, make_context
|
||||
from django.template.engine import Engine, _dirs_undefined
|
||||
from django.template.library import InvalidTemplateLibrary
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from .base import BaseEngine
|
||||
|
||||
@ -69,7 +69,7 @@ class Template(object):
|
||||
# >>> template.render(Context({'name': 'world'}))
|
||||
# In Django 1.7 get_template() returned a django.template.Template.
|
||||
# In Django 1.8 it returns a django.template.backends.django.Template.
|
||||
# In Django 2.0 the isinstance checks should be removed. If passing a
|
||||
# In Django 1.10 the isinstance checks should be removed. If passing a
|
||||
# Context or a RequestContext works by accident, it won't be an issue
|
||||
# per se, but it won't be officially supported either.
|
||||
if isinstance(context, RequestContext):
|
||||
@ -81,12 +81,12 @@ class Template(object):
|
||||
"the two arguments refer to the same request.")
|
||||
warnings.warn(
|
||||
"render() must be called with a dict, not a RequestContext.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
|
||||
elif isinstance(context, Context):
|
||||
warnings.warn(
|
||||
"render() must be called with a dict, not a Context.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
|
||||
else:
|
||||
context = make_context(context, request)
|
||||
|
@ -60,7 +60,7 @@ from django.template.context import ( # NOQA: imported for backwards compatibil
|
||||
BaseContext, Context, ContextPopException, RequestContext,
|
||||
)
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import (
|
||||
force_str, force_text, python_2_unicode_compatible,
|
||||
)
|
||||
@ -749,7 +749,7 @@ def resolve_variable(path, context):
|
||||
"""
|
||||
warnings.warn("resolve_variable() is deprecated. Use django.template."
|
||||
"Variable(path).resolve(context) instead",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
return Variable(path).resolve(context)
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ import warnings
|
||||
from contextlib import contextmanager
|
||||
from copy import copy
|
||||
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
# Hard-coded processor for easier use of CSRF protection.
|
||||
_builtin_context_processors = ('django.template.context_processors.csrf',)
|
||||
@ -136,7 +136,7 @@ class Context(BaseContext):
|
||||
warnings.warn(
|
||||
"The current_app argument of Context is deprecated. Use "
|
||||
"RequestContext and set the current_app attribute of its "
|
||||
"request instead.", RemovedInDjango20Warning, stacklevel=2)
|
||||
"request instead.", RemovedInDjango110Warning, stacklevel=2)
|
||||
self.autoescape = autoescape
|
||||
self._current_app = current_app
|
||||
self.use_l10n = use_l10n
|
||||
@ -221,7 +221,7 @@ class RequestContext(Context):
|
||||
warnings.warn(
|
||||
"The current_app argument of RequestContext is deprecated. "
|
||||
"Set the current_app attribute of its request instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
self._current_app = current_app
|
||||
self.request = request
|
||||
self._processors = () if processors is None else tuple(processors)
|
||||
|
@ -11,7 +11,7 @@ from pprint import pformat
|
||||
from django.conf import settings
|
||||
from django.utils import formats, six
|
||||
from django.utils.dateformat import format, time_format
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text, iri_to_uri
|
||||
from django.utils.html import (
|
||||
avoid_wrapping, conditional_escape, escape, escapejs, linebreaks,
|
||||
@ -716,8 +716,8 @@ def unordered_list(value, autoescape=True):
|
||||
if converted:
|
||||
warnings.warn(
|
||||
"The old style syntax in `unordered_list` is deprecated and will "
|
||||
"be removed in Django 2.0. Use the the new format instead.",
|
||||
RemovedInDjango20Warning)
|
||||
"be removed in Django 1.10. Use the the new format instead.",
|
||||
RemovedInDjango110Warning)
|
||||
return mark_safe(list_formatter(value))
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ from itertools import cycle as itertools_cycle, groupby
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils import six, timezone
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text, smart_text
|
||||
from django.utils.html import format_html
|
||||
from django.utils.lorem_ipsum import paragraphs, words
|
||||
@ -203,9 +203,9 @@ class ForNode(Node):
|
||||
if num_loopvars != len_item:
|
||||
warnings.warn(
|
||||
"Need {} values to unpack in for loop; got {}. "
|
||||
"This will raise an exception in Django 2.0."
|
||||
"This will raise an exception in Django 1.10."
|
||||
.format(num_loopvars, len_item),
|
||||
RemovedInDjango20Warning)
|
||||
RemovedInDjango110Warning)
|
||||
try:
|
||||
unpacked_vars = dict(zip(self.loopvars, item))
|
||||
except TypeError:
|
||||
@ -480,7 +480,7 @@ class URLNode(Node):
|
||||
current_app = context.request.current_app
|
||||
except AttributeError:
|
||||
# Change the fallback value to None when the deprecation path for
|
||||
# Context.current_app completes in Django 2.0.
|
||||
# Context.current_app completes in Django 1.10.
|
||||
current_app = context.current_app
|
||||
|
||||
# Try to look up the URL twice: once given the view name, and again
|
||||
@ -653,7 +653,7 @@ def cycle(parser, token):
|
||||
if ',' in args[1]:
|
||||
warnings.warn(
|
||||
"The old {% cycle %} syntax with comma-separated arguments is deprecated.",
|
||||
RemovedInDjango20Warning,
|
||||
RemovedInDjango110Warning,
|
||||
)
|
||||
# Backwards compatibility: {% cycle a,b %} or {% cycle a,b as foo %}
|
||||
# case.
|
||||
@ -1103,7 +1103,7 @@ def ssi(parser, token):
|
||||
"""
|
||||
warnings.warn(
|
||||
"The {% ssi %} tag is deprecated. Use the {% include %} tag instead.",
|
||||
RemovedInDjango20Warning,
|
||||
RemovedInDjango110Warning,
|
||||
)
|
||||
|
||||
bits = token.split_contents()
|
||||
|
@ -2,7 +2,7 @@ import warnings
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils import lru_cache, six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.module_loading import import_string
|
||||
|
||||
@ -141,7 +141,7 @@ class Engine(object):
|
||||
warnings.warn(
|
||||
"%s inherits from django.template.loader.BaseLoader "
|
||||
"instead of django.template.loaders.base.Loader. " %
|
||||
loader, RemovedInDjango20Warning, stacklevel=2)
|
||||
loader, RemovedInDjango110Warning, stacklevel=2)
|
||||
|
||||
return loader_class(*args)
|
||||
else:
|
||||
@ -160,7 +160,7 @@ class Engine(object):
|
||||
except TemplateDoesNotExist as e:
|
||||
tried.extend(e.tried)
|
||||
else:
|
||||
# RemovedInDjango21Warning: Use old api for non-recursive
|
||||
# RemovedInDjango20Warning: Use old api for non-recursive
|
||||
# loaders.
|
||||
try:
|
||||
return loader(name, dirs)
|
||||
@ -185,7 +185,7 @@ class Engine(object):
|
||||
else:
|
||||
warnings.warn(
|
||||
"The dirs argument of get_template is deprecated.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
|
||||
template, origin = self.find_template(template_name, dirs)
|
||||
if not hasattr(template, 'render'):
|
||||
@ -196,7 +196,7 @@ class Engine(object):
|
||||
# This method was originally a function defined in django.template.loader.
|
||||
# It was moved here in Django 1.8 when encapsulating the Django template
|
||||
# engine in this Engine class. It's still called by deprecated code but it
|
||||
# will be removed in Django 2.0. It's superseded by a new render_to_string
|
||||
# will be removed in Django 1.10. It's superseded by a new render_to_string
|
||||
# function in django.template.loader.
|
||||
|
||||
def render_to_string(self, template_name, context=None,
|
||||
@ -208,7 +208,7 @@ class Engine(object):
|
||||
else:
|
||||
warnings.warn(
|
||||
"The context_instance argument of render_to_string is "
|
||||
"deprecated.", RemovedInDjango20Warning, stacklevel=2)
|
||||
"deprecated.", RemovedInDjango110Warning, stacklevel=2)
|
||||
if dirs is _dirs_undefined:
|
||||
# Do not set dirs to None here to avoid triggering the deprecation
|
||||
# warning in select_template or get_template.
|
||||
@ -216,13 +216,13 @@ class Engine(object):
|
||||
else:
|
||||
warnings.warn(
|
||||
"The dirs argument of render_to_string is deprecated.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
if dictionary is _dictionary_undefined:
|
||||
dictionary = None
|
||||
else:
|
||||
warnings.warn(
|
||||
"The dictionary argument of render_to_string was renamed to "
|
||||
"context.", RemovedInDjango20Warning, stacklevel=2)
|
||||
"context.", RemovedInDjango110Warning, stacklevel=2)
|
||||
context = dictionary
|
||||
|
||||
if isinstance(template_name, (list, tuple)):
|
||||
@ -254,7 +254,7 @@ class Engine(object):
|
||||
else:
|
||||
warnings.warn(
|
||||
"The dirs argument of select_template is deprecated.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
|
||||
if not template_name_list:
|
||||
raise TemplateDoesNotExist("No template names provided")
|
||||
|
@ -3,7 +3,7 @@ import warnings
|
||||
from importlib import import_module
|
||||
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.inspect import getargspec
|
||||
from django.utils.itercompat import is_iterable
|
||||
|
||||
@ -136,7 +136,7 @@ class Library(object):
|
||||
def assignment_tag(self, func=None, takes_context=None, name=None):
|
||||
warnings.warn(
|
||||
"assignment_tag() is deprecated. Use simple_tag() instead",
|
||||
RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.simple_tag(func, takes_context, name)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import warnings
|
||||
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from . import engines
|
||||
from .backends.django import DjangoTemplates
|
||||
@ -22,7 +22,7 @@ def get_template(template_name, dirs=_dirs_undefined, using=None):
|
||||
for engine in engines:
|
||||
try:
|
||||
# This is required for deprecating the dirs argument. Simply
|
||||
# return engine.get_template(template_name) in Django 2.0.
|
||||
# return engine.get_template(template_name) in Django 1.10.
|
||||
if isinstance(engine, DjangoTemplates):
|
||||
return engine.get_template(template_name, dirs)
|
||||
elif dirs is not _dirs_undefined:
|
||||
@ -52,7 +52,7 @@ def select_template(template_name_list, dirs=_dirs_undefined, using=None):
|
||||
for engine in engines:
|
||||
try:
|
||||
# This is required for deprecating the dirs argument. Simply
|
||||
# use engine.get_template(template_name) in Django 2.0.
|
||||
# use engine.get_template(template_name) in Django 1.10.
|
||||
if isinstance(engine, DjangoTemplates):
|
||||
return engine.get_template(template_name, dirs)
|
||||
elif dirs is not _dirs_undefined:
|
||||
@ -98,7 +98,7 @@ def render_to_string(template_name, context=None,
|
||||
try:
|
||||
# This is required for deprecating properly arguments specific
|
||||
# to Django templates. Remove Engine.render_to_string() at the
|
||||
# same time as this code path in Django 2.0.
|
||||
# same time as this code path in Django 1.10.
|
||||
if isinstance(engine, DjangoTemplates):
|
||||
if request is not None:
|
||||
raise ValueError(
|
||||
@ -146,5 +146,5 @@ class BaseLoader(base.Loader):
|
||||
warnings.warn(
|
||||
"django.template.loader.BaseLoader was superseded by "
|
||||
"django.template.loaders.base.Loader.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
super(BaseLoader, self).__init__(*args, **kwargs)
|
||||
|
@ -101,7 +101,7 @@ class ExtendsNode(Node):
|
||||
passed as the skip argument. This enables extends to work recursively
|
||||
without extending the same template twice.
|
||||
"""
|
||||
# RemovedInDjango21Warning: If any non-recursive loaders are installed
|
||||
# RemovedInDjango20Warning: If any non-recursive loaders are installed
|
||||
# do a direct template lookup. If the same template name appears twice,
|
||||
# raise an exception to avoid system recursion.
|
||||
for loader in context.template.engine.template_loaders:
|
||||
|
@ -1,19 +1,20 @@
|
||||
import warnings
|
||||
|
||||
from django.template import Origin, Template, TemplateDoesNotExist
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.inspect import func_supports_parameter
|
||||
|
||||
|
||||
class Loader(object):
|
||||
# Only used to raise a deprecation warning. Remove in Django 2.0.
|
||||
# Only used to raise a deprecation warning. Remove in Django 1.10.
|
||||
is_usable = False
|
||||
_accepts_engine_in_init = True
|
||||
|
||||
def __init__(self, engine):
|
||||
self.engine = engine
|
||||
|
||||
def __call__(self, template_name, template_dirs=None):
|
||||
# RemovedInDjango21Warning: Allow loaders to be called like functions.
|
||||
# RemovedInDjango20Warning: Allow loaders to be called like functions.
|
||||
return self.load_template(template_name, template_dirs)
|
||||
|
||||
def get_template(self, template_name, template_dirs=None, skip=None):
|
||||
@ -26,7 +27,7 @@ class Loader(object):
|
||||
tried = []
|
||||
|
||||
args = [template_name]
|
||||
# RemovedInDjango21Warning: Add template_dirs for compatibility with
|
||||
# RemovedInDjango20Warning: Add template_dirs for compatibility with
|
||||
# old loaders
|
||||
if func_supports_parameter(self.get_template_sources, 'template_dirs'):
|
||||
args.append(template_dirs)
|
||||
@ -51,7 +52,7 @@ class Loader(object):
|
||||
def load_template(self, template_name, template_dirs=None):
|
||||
warnings.warn(
|
||||
'The load_template() method is deprecated. Use get_template() '
|
||||
'instead.', RemovedInDjango21Warning,
|
||||
'instead.', RemovedInDjango20Warning,
|
||||
)
|
||||
source, display_name = self.load_template_source(
|
||||
template_name, template_dirs,
|
||||
@ -83,7 +84,7 @@ class Loader(object):
|
||||
|
||||
def load_template_source(self, template_name, template_dirs=None):
|
||||
"""
|
||||
RemovedInDjango21Warning: Returns a tuple containing the source and
|
||||
RemovedInDjango20Warning: Returns a tuple containing the source and
|
||||
origin for the given template name.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
@ -100,7 +101,7 @@ class Loader(object):
|
||||
@property
|
||||
def supports_recursion(self):
|
||||
"""
|
||||
RemovedInDjango21Warning: This is an internal property used by the
|
||||
RemovedInDjango20Warning: This is an internal property used by the
|
||||
ExtendsNode during the deprecation of non-recursive loaders.
|
||||
"""
|
||||
return hasattr(self, 'get_contents')
|
||||
|
@ -7,7 +7,7 @@ import hashlib
|
||||
import warnings
|
||||
|
||||
from django.template import Origin, Template, TemplateDoesNotExist
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.inspect import func_supports_parameter
|
||||
|
||||
@ -18,7 +18,7 @@ class Loader(BaseLoader):
|
||||
|
||||
def __init__(self, engine, loaders):
|
||||
self.template_cache = {}
|
||||
self.find_template_cache = {} # RemovedInDjango21Warning
|
||||
self.find_template_cache = {} # RemovedInDjango20Warning
|
||||
self.get_template_cache = {}
|
||||
self.loaders = engine.get_template_loaders(loaders)
|
||||
super(Loader, self).__init__(engine)
|
||||
@ -49,7 +49,7 @@ class Loader(BaseLoader):
|
||||
def get_template_sources(self, template_name, template_dirs=None):
|
||||
for loader in self.loaders:
|
||||
args = [template_name]
|
||||
# RemovedInDjango21Warning: Add template_dirs for compatibility
|
||||
# RemovedInDjango20Warning: Add template_dirs for compatibility
|
||||
# with old loaders
|
||||
if func_supports_parameter(loader.get_template_sources, 'template_dirs'):
|
||||
args.append(template_dirs)
|
||||
@ -87,14 +87,14 @@ class Loader(BaseLoader):
|
||||
@property
|
||||
def supports_recursion(self):
|
||||
"""
|
||||
RemovedInDjango21Warning: This is an internal property used by the
|
||||
RemovedInDjango20Warning: This is an internal property used by the
|
||||
ExtendsNode during the deprecation of non-recursive loaders.
|
||||
"""
|
||||
return all(hasattr(loader, 'get_contents') for loader in self.loaders)
|
||||
|
||||
def find_template(self, name, dirs=None):
|
||||
"""
|
||||
RemovedInDjango21Warning: An internal method to lookup the template
|
||||
RemovedInDjango20Warning: An internal method to lookup the template
|
||||
name in all the configured loaders.
|
||||
"""
|
||||
key = self.cache_key(name, dirs)
|
||||
@ -125,7 +125,7 @@ class Loader(BaseLoader):
|
||||
def load_template(self, template_name, template_dirs=None):
|
||||
warnings.warn(
|
||||
'The load_template() method is deprecated. Use get_template() '
|
||||
'instead.', RemovedInDjango21Warning,
|
||||
'instead.', RemovedInDjango20Warning,
|
||||
)
|
||||
key = self.cache_key(template_name, template_dirs)
|
||||
template_tuple = self.template_cache.get(key)
|
||||
@ -149,5 +149,5 @@ class Loader(BaseLoader):
|
||||
def reset(self):
|
||||
"Empty the template cache."
|
||||
self.template_cache.clear()
|
||||
self.find_template_cache.clear() # RemovedInDjango21Warning
|
||||
self.find_template_cache.clear() # RemovedInDjango20Warning
|
||||
self.get_template_cache.clear()
|
||||
|
@ -6,7 +6,7 @@ import warnings
|
||||
from django.apps import apps
|
||||
from django.template import Origin, TemplateDoesNotExist
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from .base import Loader as BaseLoader
|
||||
|
||||
@ -62,7 +62,7 @@ class Loader(BaseLoader):
|
||||
warnings.warn(
|
||||
'The load_template_sources() method is deprecated. Use '
|
||||
'get_template() or get_contents() instead.',
|
||||
RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning,
|
||||
)
|
||||
for origin in self.get_template_sources(template_name):
|
||||
try:
|
||||
|
@ -9,7 +9,7 @@ import warnings
|
||||
from django.core.exceptions import SuspiciousFileOperation
|
||||
from django.template import Origin, TemplateDoesNotExist
|
||||
from django.utils._os import safe_join
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from .base import Loader as BaseLoader
|
||||
|
||||
@ -54,7 +54,7 @@ class Loader(BaseLoader):
|
||||
warnings.warn(
|
||||
'The load_template_sources() method is deprecated. Use '
|
||||
'get_template() or get_contents() instead.',
|
||||
RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning,
|
||||
)
|
||||
for origin in self.get_template_sources(template_name, template_dirs):
|
||||
try:
|
||||
|
@ -5,7 +5,7 @@ Wrapper for loading templates from a plain Python dict.
|
||||
import warnings
|
||||
|
||||
from django.template import Origin, TemplateDoesNotExist
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from .base import Loader as BaseLoader
|
||||
|
||||
@ -33,7 +33,7 @@ class Loader(BaseLoader):
|
||||
warnings.warn(
|
||||
'The load_template_sources() method is deprecated. Use '
|
||||
'get_template() or get_contents() instead.',
|
||||
RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning,
|
||||
)
|
||||
try:
|
||||
return self.templates_dict[template_name], template_name
|
||||
|
@ -2,7 +2,7 @@ import warnings
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from .backends.django import Template as BackendTemplate
|
||||
from .base import Template
|
||||
@ -24,7 +24,7 @@ class SimpleTemplateResponse(HttpResponse):
|
||||
"{}'s template argument cannot be a django.template.Template "
|
||||
"anymore. It may be a backend-specific template like those "
|
||||
"created by get_template().".format(self.__class__.__name__),
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
template = BackendTemplate(template)
|
||||
|
||||
# It would seem obvious to call these next two members 'template' and
|
||||
@ -86,7 +86,7 @@ class SimpleTemplateResponse(HttpResponse):
|
||||
def _resolve_template(self, template):
|
||||
# This wrapper deprecates returning a django.template.Template in
|
||||
# subclasses that override resolve_template. It can be removed in
|
||||
# Django 2.0.
|
||||
# Django 1.10.
|
||||
new_template = self.resolve_template(template)
|
||||
if isinstance(new_template, Template):
|
||||
warnings.warn(
|
||||
@ -94,7 +94,7 @@ class SimpleTemplateResponse(HttpResponse):
|
||||
"template like those created by get_template(), not a "
|
||||
"{}.".format(
|
||||
self.__class__.__name__, new_template.__class__.__name__),
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
new_template = BackendTemplate(new_template)
|
||||
return new_template
|
||||
|
||||
@ -104,7 +104,7 @@ class SimpleTemplateResponse(HttpResponse):
|
||||
def _resolve_context(self, context):
|
||||
# This wrapper deprecates returning a Context or a RequestContext in
|
||||
# subclasses that override resolve_context. It can be removed in
|
||||
# Django 2.0. If returning a Context or a RequestContext works by
|
||||
# Django 1.10. If returning a Context or a RequestContext works by
|
||||
# accident, it won't be an issue per se, but it won't be officially
|
||||
# supported either.
|
||||
new_context = self.resolve_context(context)
|
||||
@ -114,7 +114,7 @@ class SimpleTemplateResponse(HttpResponse):
|
||||
warnings.warn(
|
||||
"{}.resolve_context() must return a dict, not a {}.".format(
|
||||
self.__class__.__name__, new_context.__class__.__name__),
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
# It would be tempting to do new_context = new_context.flatten()
|
||||
# here but that would cause template context processors to run for
|
||||
# TemplateResponse(request, template, Context({})), which would be
|
||||
@ -201,7 +201,7 @@ class TemplateResponse(SimpleTemplateResponse):
|
||||
warnings.warn(
|
||||
"The current_app argument of TemplateResponse is deprecated. "
|
||||
"Set the current_app attribute of its request instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
request.current_app = current_app
|
||||
super(TemplateResponse, self).__init__(
|
||||
template, context, content_type, status, charset, using)
|
||||
|
@ -3,7 +3,7 @@ Parser and utilities for the smart 'if' tag
|
||||
"""
|
||||
import warnings
|
||||
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
|
||||
# Using a simple top down parser, as described here:
|
||||
@ -102,7 +102,7 @@ OPERATORS = {
|
||||
'not': prefix(8, lambda context, x: not x.eval(context)),
|
||||
'in': infix(9, lambda context, x, y: x.eval(context) in y.eval(context)),
|
||||
'not in': infix(9, lambda context, x, y: x.eval(context) not in y.eval(context)),
|
||||
# This should be removed in Django 2.0:
|
||||
# This should be removed in Django 1.10:
|
||||
'=': infix(10, lambda context, x, y: x.eval(context) == y.eval(context)),
|
||||
'==': infix(10, lambda context, x, y: x.eval(context) == y.eval(context)),
|
||||
'!=': infix(10, lambda context, x, y: x.eval(context) != y.eval(context)),
|
||||
@ -180,8 +180,8 @@ class IfParser(object):
|
||||
else:
|
||||
if token == '=':
|
||||
warnings.warn(
|
||||
"Operator '=' is deprecated and will be removed in Django 2.0. Use '==' instead.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
"Operator '=' is deprecated and will be removed in Django 1.10. Use '==' instead.",
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
return op()
|
||||
|
||||
|
@ -7,7 +7,7 @@ from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils import lru_cache
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.module_loading import import_string
|
||||
|
||||
@ -33,8 +33,8 @@ class EngineHandler(object):
|
||||
if not self._templates:
|
||||
warnings.warn(
|
||||
"You haven't defined a TEMPLATES setting. You must do so "
|
||||
"before upgrading to Django 2.0. Otherwise Django will be "
|
||||
"unable to load templates.", RemovedInDjango20Warning)
|
||||
"before upgrading to Django 1.10. Otherwise Django will be "
|
||||
"unable to load templates.", RemovedInDjango110Warning)
|
||||
self._templates = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import warnings
|
||||
|
||||
from django.template import Library, defaulttags
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
register = Library()
|
||||
|
||||
@ -27,8 +27,8 @@ def cycle(parser, token):
|
||||
"""
|
||||
warnings.warn(
|
||||
"Loading the `cycle` tag from the `future` library is deprecated and "
|
||||
"will be removed in Django 2.0. Use the default `cycle` tag instead.",
|
||||
RemovedInDjango20Warning)
|
||||
"will be removed in Django 1.10. Use the default `cycle` tag instead.",
|
||||
RemovedInDjango110Warning)
|
||||
return defaulttags.cycle(parser, token)
|
||||
|
||||
|
||||
@ -62,6 +62,6 @@ def firstof(parser, token):
|
||||
"""
|
||||
warnings.warn(
|
||||
"Loading the `firstof` tag from the `future` library is deprecated and "
|
||||
"will be removed in Django 2.0. Use the default `firstof` tag instead.",
|
||||
RemovedInDjango20Warning)
|
||||
"will be removed in Django 1.10. Use the default `firstof` tag instead.",
|
||||
RemovedInDjango110Warning)
|
||||
return defaulttags.firstof(parser, token)
|
||||
|
@ -39,7 +39,7 @@ from django.test.utils import (
|
||||
from django.utils import six
|
||||
from django.utils.decorators import classproperty
|
||||
from django.utils.deprecation import (
|
||||
RemovedInDjango20Warning, RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning, RemovedInDjango110Warning,
|
||||
)
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.six.moves.urllib.parse import (
|
||||
@ -233,9 +233,9 @@ class SimpleTestCase(unittest.TestCase):
|
||||
if hasattr(self, 'urls'):
|
||||
warnings.warn(
|
||||
"SimpleTestCase.urls is deprecated and will be removed in "
|
||||
"Django 2.0. Use @override_settings(ROOT_URLCONF=...) "
|
||||
"Django 1.10. Use @override_settings(ROOT_URLCONF=...) "
|
||||
"in %s instead." % self.__class__.__name__,
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
set_urlconf(None)
|
||||
self._old_root_urlconf = settings.ROOT_URLCONF
|
||||
settings.ROOT_URLCONF = self.urls
|
||||
@ -280,7 +280,7 @@ class SimpleTestCase(unittest.TestCase):
|
||||
if host is not None:
|
||||
warnings.warn(
|
||||
"The host argument is deprecated and no longer used by assertRedirects",
|
||||
RemovedInDjango21Warning, stacklevel=2
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
)
|
||||
|
||||
if msg_prefix:
|
||||
@ -337,7 +337,7 @@ class SimpleTestCase(unittest.TestCase):
|
||||
"expected URL, as it was always added automatically to URLs "
|
||||
"before Django 1.9. Please update your expected URLs by "
|
||||
"removing the scheme and domain.",
|
||||
RemovedInDjango21Warning, stacklevel=2)
|
||||
RemovedInDjango20Warning, stacklevel=2)
|
||||
expected_url = relative_url
|
||||
|
||||
self.assertEqual(url, expected_url,
|
||||
|
@ -7,12 +7,12 @@ __all__ = ['luhn']
|
||||
import warnings
|
||||
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
warnings.warn(
|
||||
"django.utils.checksums will be removed in Django 2.0. The "
|
||||
"django.utils.checksums will be removed in Django 1.10. The "
|
||||
"luhn() function is now included in django-localflavor 1.1+.",
|
||||
RemovedInDjango20Warning
|
||||
RemovedInDjango110Warning
|
||||
)
|
||||
|
||||
LUHN_ODD_LOOKUP = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9) # sum_of_digits(index * 2)
|
||||
|
@ -4,15 +4,15 @@ import inspect
|
||||
import warnings
|
||||
|
||||
|
||||
class RemovedInDjango21Warning(PendingDeprecationWarning):
|
||||
class RemovedInDjango20Warning(PendingDeprecationWarning):
|
||||
pass
|
||||
|
||||
|
||||
class RemovedInDjango20Warning(DeprecationWarning):
|
||||
class RemovedInDjango110Warning(DeprecationWarning):
|
||||
pass
|
||||
|
||||
|
||||
RemovedInNextVersionWarning = RemovedInDjango20Warning
|
||||
RemovedInNextVersionWarning = RemovedInDjango110Warning
|
||||
|
||||
|
||||
class warn_about_renamed_method(object):
|
||||
|
@ -27,7 +27,7 @@ import datetime
|
||||
import warnings
|
||||
|
||||
from django.utils import datetime_safe, six
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.encoding import force_text, iri_to_uri
|
||||
from django.utils.six import StringIO
|
||||
from django.utils.six.moves.urllib.parse import urlparse
|
||||
@ -268,7 +268,7 @@ class RssFeed(SyndicationFeed):
|
||||
warnings.warn(
|
||||
'The mime_type attribute of RssFeed is deprecated. '
|
||||
'Use content_type instead.',
|
||||
RemovedInDjango21Warning, stacklevel=2
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
)
|
||||
return self.content_type
|
||||
|
||||
@ -426,7 +426,7 @@ class Atom1Feed(SyndicationFeed):
|
||||
warnings.warn(
|
||||
'The mime_type attribute of Atom1Feed is deprecated. '
|
||||
'Use content_type instead.',
|
||||
RemovedInDjango21Warning, stacklevel=2
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
)
|
||||
return self.content_type
|
||||
|
||||
|
@ -6,7 +6,7 @@ import re
|
||||
import warnings
|
||||
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_str, force_text
|
||||
from django.utils.functional import allow_lazy
|
||||
from django.utils.http import RFC3986_GENDELIMS, RFC3986_SUBDELIMS
|
||||
@ -190,7 +190,7 @@ def remove_tags(html, tags):
|
||||
warnings.warn(
|
||||
"django.utils.html.remove_tags() and the removetags template filter "
|
||||
"are deprecated. Consider using the bleach library instead.",
|
||||
RemovedInDjango20Warning, stacklevel=3
|
||||
RemovedInDjango110Warning, stacklevel=3
|
||||
)
|
||||
tags = [re.escape(tag) for tag in tags.split()]
|
||||
tags_re = '(%s)' % '|'.join(tags)
|
||||
@ -212,7 +212,7 @@ def strip_entities(value):
|
||||
"""Returns the given HTML with all entities (&something;) stripped."""
|
||||
warnings.warn(
|
||||
"django.utils.html.strip_entities() is deprecated.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
return re.sub(r'&(?:\w+|#\d+);', '', force_text(value))
|
||||
strip_entities = allow_lazy(strip_entities, six.text_type)
|
||||
|
@ -6,14 +6,14 @@ from django.core.exceptions import ImproperlyConfigured
|
||||
from django.forms import models as model_forms
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text
|
||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||
from django.views.generic.detail import (
|
||||
BaseDetailView, SingleObjectMixin, SingleObjectTemplateResponseMixin,
|
||||
)
|
||||
|
||||
PERCENT_PLACEHOLDER_REGEX = re.compile(r'%\([^\)]+\)') # RemovedInDjango20Warning
|
||||
PERCENT_PLACEHOLDER_REGEX = re.compile(r'%\([^\)]+\)') # RemovedInDjango110Warning
|
||||
|
||||
|
||||
class FormMixinBase(type):
|
||||
@ -26,7 +26,7 @@ class FormMixinBase(type):
|
||||
warnings.warn(
|
||||
"`%s.%s.get_form` method must define a default value for "
|
||||
"its `form_class` argument." % (attrs['__module__'], name),
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
|
||||
def get_form_with_form_class(self, form_class=None):
|
||||
@ -179,7 +179,7 @@ class ModelFormMixin(FormMixin, SingleObjectMixin):
|
||||
warnings.warn(
|
||||
"%()s placeholder style in success_url is deprecated. "
|
||||
"Please replace them by the {} Python format syntax.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
url = self.success_url % self.object.__dict__
|
||||
else:
|
||||
@ -314,7 +314,7 @@ class DeletionMixin(object):
|
||||
warnings.warn(
|
||||
"%()s placeholder style in success_url is deprecated. "
|
||||
"Please replace them by the {} Python format syntax.",
|
||||
RemovedInDjango20Warning, stacklevel=2
|
||||
RemovedInDjango110Warning, stacklevel=2
|
||||
)
|
||||
return self.success_url % self.object.__dict__
|
||||
else:
|
||||
|
@ -7,9 +7,9 @@ in a backward incompatible way, following their deprecation, as per the
|
||||
:ref:`deprecation policy <internal-release-deprecation-policy>`. More details
|
||||
about each item can often be found in the release notes of two versions prior.
|
||||
|
||||
.. _deprecation-removed-in-2.1:
|
||||
.. _deprecation-removed-in-2.0:
|
||||
|
||||
2.1
|
||||
2.0
|
||||
---
|
||||
|
||||
See the :ref:`Django 1.9 release notes<deprecated-features-1.9>` for more
|
||||
@ -79,10 +79,10 @@ details on these changes.
|
||||
* Support for setting a URL instance namespace without an application
|
||||
namespace will be removed.
|
||||
|
||||
.. _deprecation-removed-in-2.0:
|
||||
.. _deprecation-removed-in-1.10:
|
||||
|
||||
2.0
|
||||
---
|
||||
1.10
|
||||
----
|
||||
|
||||
See the :ref:`Django 1.8 release notes<deprecated-features-1.8>` for more
|
||||
details on these changes.
|
||||
|
@ -164,7 +164,7 @@ ModelFormMixin
|
||||
|
||||
Support for the new brace-based Python formatting syntax has been
|
||||
added. The old ``%(slug)s`` placeholder syntax support has been
|
||||
deprecated and will be removed in Django 2.0.
|
||||
deprecated and will be removed in Django 1.10.
|
||||
|
||||
.. method:: get_form_class()
|
||||
|
||||
@ -263,7 +263,7 @@ DeletionMixin
|
||||
|
||||
Support for the new brace-based Python formatting syntax has been
|
||||
added. The old ``%(slug)s`` placeholder syntax support has been
|
||||
deprecated and will be removed in Django 2.0.
|
||||
deprecated and will be removed in Django 1.10.
|
||||
|
||||
.. method:: get_success_url()
|
||||
|
||||
|
@ -830,7 +830,7 @@ For each field, we describe the default widget used if you don't specify
|
||||
.. deprecated:: 1.8
|
||||
|
||||
The optional argument ``error_message`` is also accepted for backwards
|
||||
compatibility but will be removed in Django 2.0. The preferred way to
|
||||
compatibility but will be removed in Django 1.10. The preferred way to
|
||||
provide an error message is to use the :attr:`~Field.error_messages`
|
||||
argument, passing a dictionary with ``'invalid'`` as a key and the error
|
||||
message as the value.
|
||||
|
@ -151,7 +151,7 @@ Migrating from the old API
|
||||
|
||||
As part of the formalization of the ``Model._meta`` API (from the
|
||||
:class:`django.db.models.options.Options` class), a number of methods and
|
||||
properties have been deprecated and will be removed in Django 2.0.
|
||||
properties have been deprecated and will be removed in Django 1.10.
|
||||
|
||||
These old APIs can be replicated by either:
|
||||
|
||||
|
@ -109,7 +109,7 @@ Default: ``[]`` (Empty list)
|
||||
.. deprecated:: 1.8
|
||||
|
||||
This setting, along with the :ttag:`ssi` template tag, is deprecated and
|
||||
will be removed in Django 2.0.
|
||||
will be removed in Django 1.10.
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
|
@ -994,7 +994,7 @@ ssi
|
||||
|
||||
.. deprecated:: 1.8
|
||||
|
||||
This tag has been deprecated and will be removed in Django 2.0. Use the
|
||||
This tag has been deprecated and will be removed in Django 1.10. Use the
|
||||
:ttag:`include` tag instead.
|
||||
|
||||
Outputs the contents of a given file into the page.
|
||||
@ -1139,7 +1139,7 @@ by the context as to the current application.
|
||||
.. deprecated:: 1.8
|
||||
|
||||
The dotted Python path syntax is deprecated and will be removed in
|
||||
Django 2.0::
|
||||
Django 1.10::
|
||||
|
||||
{% url 'path.to.some_view' v1 v2 %}
|
||||
|
||||
@ -2320,7 +2320,7 @@ contains ``['States', ['Kansas', ['Lawrence', 'Topeka'], 'Illinois']]``, then
|
||||
|
||||
An older, more restrictive and verbose input format is also supported:
|
||||
``['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]``.
|
||||
Support for this syntax will be removed in Django 2.0.
|
||||
Support for this syntax will be removed in Django 1.10.
|
||||
|
||||
.. templatefilter:: upper
|
||||
|
||||
|
@ -150,7 +150,7 @@ You should write::
|
||||
Passing a :class:`~django.template.Context` or a
|
||||
:class:`~django.template.RequestContext` is still possible when the template
|
||||
is loaded by a :class:`~django.template.backends.django.DjangoTemplates`
|
||||
backend but it's deprecated and won't be supported in Django 2.0.
|
||||
backend but it's deprecated and won't be supported in Django 1.10.
|
||||
|
||||
If you're loading a template while you're rendering another template with the
|
||||
Django template language and you have access to the current context, for
|
||||
|
@ -119,7 +119,7 @@ parameter is useful.
|
||||
.. deprecated:: 1.8
|
||||
|
||||
Support for string ``view`` arguments is deprecated and will be removed in
|
||||
Django 2.0. Pass the callable instead.
|
||||
Django 1.10. Pass the callable instead.
|
||||
|
||||
The ``prefix`` parameter has the same meaning as the first argument to
|
||||
``patterns()`` and is only relevant when you're passing a string as the
|
||||
@ -163,15 +163,15 @@ See :ref:`including-other-urlconfs` and :ref:`namespaces-and-include`.
|
||||
.. deprecated:: 1.9
|
||||
|
||||
Support for the ``app_name`` argument is deprecated and will be removed in
|
||||
Django 2.1. Specify the ``app_name`` as explained in
|
||||
Django 2.0. Specify the ``app_name`` as explained in
|
||||
:ref:`namespaces-and-include` instead.
|
||||
|
||||
Support for passing a 3-tuple is also deprecated and will be removed in
|
||||
Django 2.1. Pass a 2-tuple containing the pattern list and application
|
||||
Django 2.0. Pass a 2-tuple containing the pattern list and application
|
||||
namespace, and use the ``namespace`` argument instead.
|
||||
|
||||
Lastly, support for an instance namespace without an application namespace
|
||||
has been deprecated and will be removed in Django 2.1. Specify the
|
||||
has been deprecated and will be removed in Django 2.0. Specify the
|
||||
application namespace or remove the instance namespace.
|
||||
|
||||
handler400
|
||||
|
@ -6,6 +6,11 @@ Django 1.8.3 release notes
|
||||
|
||||
Django 1.8.3 fixes several bugs in 1.8.2.
|
||||
|
||||
Also, ``django.utils.deprecation.RemovedInDjango20Warning`` was renamed to
|
||||
``RemovedInDjango110Warning`` as the version roadmap was revised to 1.9, 1.10,
|
||||
1.11 (LTS), 2.0 (drops Python 2 support). For backwards compatibility,
|
||||
``RemovedInDjango20Warning`` remains as an importable alias.
|
||||
|
||||
Bugfixes
|
||||
========
|
||||
|
||||
|
@ -380,7 +380,7 @@ Generic Views
|
||||
* Placeholders in :attr:`ModelFormMixin.success_url
|
||||
<django.views.generic.edit.ModelFormMixin.success_url>` now support the Python
|
||||
:py:meth:`str.format()` syntax. The legacy ``%(<foo>)s`` syntax is still
|
||||
supported but will be removed in Django 2.0.
|
||||
supported but will be removed in Django 1.10.
|
||||
|
||||
Internationalization
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
@ -1182,7 +1182,7 @@ Selected methods in ``django.db.models.options.Options``
|
||||
|
||||
As part of the formalization of the ``Model._meta`` API (from the
|
||||
:class:`django.db.models.options.Options` class), a number of methods have been
|
||||
deprecated and will be removed in Django 2.0:
|
||||
deprecated and will be removed in Django 1.10:
|
||||
|
||||
* ``get_all_field_names()``
|
||||
* ``get_all_related_objects()``
|
||||
@ -1203,7 +1203,7 @@ Loading ``cycle`` and ``firstof`` template tags from ``future`` library
|
||||
Django 1.6 introduced ``{% load cycle from future %}`` and
|
||||
``{% load firstof from future %}`` syntax for forward compatibility of the
|
||||
:ttag:`cycle` and :ttag:`firstof` template tags. This syntax is now deprecated
|
||||
and will be removed in Django 2.0. You can simply remove the
|
||||
and will be removed in Django 1.10. You can simply remove the
|
||||
``{% load ... from future %}`` tags.
|
||||
|
||||
``django.conf.urls.patterns()``
|
||||
@ -1289,7 +1289,7 @@ Built-in template context processors have been moved to
|
||||
|
||||
The attribute :attr:`SimpleTestCase.urls <django.test.SimpleTestCase.urls>`
|
||||
for specifying URLconf configuration in tests has been deprecated and will be
|
||||
removed in Django 2.0. Use :func:`@override_settings(ROOT_URLCONF=...)
|
||||
removed in Django 1.10. Use :func:`@override_settings(ROOT_URLCONF=...)
|
||||
<django.test.override_settings>` instead.
|
||||
|
||||
``prefix`` argument to :func:`~django.conf.urls.i18n.i18n_patterns`
|
||||
@ -1303,7 +1303,7 @@ Using an incorrect count of unpacked values in the :ttag:`for` template tag
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Using an incorrect count of unpacked values in :ttag:`for` tag will raise an
|
||||
exception rather than fail silently in Django 2.0.
|
||||
exception rather than fail silently in Django 1.10.
|
||||
|
||||
Passing a dotted path to :func:`~django.core.urlresolvers.reverse()` and :ttag:`url`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -1321,7 +1321,7 @@ the ``url`` that references :func:`django.contrib.sitemaps.views.sitemap`::
|
||||
url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
|
||||
name='django.contrib.sitemaps.views.sitemap')
|
||||
|
||||
to ensure compatibility when reversing by Python path is removed in Django 2.0.
|
||||
to ensure compatibility when reversing by Python path is removed in Django 1.10.
|
||||
|
||||
Similarly for GIS sitemaps, add ``name='django.contrib.gis.sitemaps.views.kml'``
|
||||
or ``name='django.contrib.gis.sitemaps.views.kmz'``.
|
||||
@ -1335,7 +1335,7 @@ The ``django.db.models.sql.aggregates`` and
|
||||
``django.contrib.gis.db.models.sql.aggregates`` modules (both private API), have
|
||||
been deprecated as ``django.db.models.aggregates`` and
|
||||
``django.contrib.gis.db.models.aggregates`` are now also responsible
|
||||
for SQL generation. The old modules will be removed in Django 2.0.
|
||||
for SQL generation. The old modules will be removed in Django 1.10.
|
||||
|
||||
If you were using the old modules, see :doc:`Query Expressions
|
||||
</ref/models/expressions>` for instructions on rewriting custom aggregates
|
||||
@ -1343,7 +1343,7 @@ using the new stable API.
|
||||
|
||||
The following methods and properties of ``django.db.models.sql.query.Query``
|
||||
have also been deprecated and the backwards compatibility shims will be removed
|
||||
in Django 2.0:
|
||||
in Django 1.10:
|
||||
|
||||
* ``Query.aggregates``, replaced by ``annotations``.
|
||||
* ``Query.aggregate_select``, replaced by ``annotation_select``.
|
||||
@ -1366,14 +1366,14 @@ arguments through ``argparse.add_argument()``. See
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The class :class:`~django.core.management.NoArgsCommand` is now deprecated and
|
||||
will be removed in Django 2.0. Use :class:`~django.core.management.BaseCommand`
|
||||
will be removed in Django 1.10. Use :class:`~django.core.management.BaseCommand`
|
||||
instead, which takes no arguments by default.
|
||||
|
||||
Listing all migrations in a project
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``--list`` option of the :djadmin:`migrate` management command is
|
||||
deprecated and will be removed in Django 2.0. Use :djadmin:`showmigrations`
|
||||
deprecated and will be removed in Django 1.10. Use :djadmin:`showmigrations`
|
||||
instead.
|
||||
|
||||
``cache_choices`` option of ``ModelChoiceField`` and ``ModelMultipleChoiceField``
|
||||
@ -1421,7 +1421,7 @@ Using the new syntax, this becomes::
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Rename this method to :meth:`~django.forms.Field.has_changed` by removing the
|
||||
leading underscore. The old name will still work until Django 2.0.
|
||||
leading underscore. The old name will still work until Django 1.10.
|
||||
|
||||
``django.utils.html.remove_tags()`` and ``removetags`` template filter
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -1443,7 +1443,7 @@ It's a legacy option that should no longer be necessary.
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
``django.db.models.fields.subclassing.SubfieldBase`` has been deprecated and
|
||||
will be removed in Django 2.0. Historically, it was used to handle fields where
|
||||
will be removed in Django 1.10. Historically, it was used to handle fields where
|
||||
type conversion was needed when loading from the database, but it was not used
|
||||
in ``.values()`` calls or in aggregates. It has been replaced with
|
||||
:meth:`~django.db.models.Field.from_db_value`. Note that the new approach does
|
||||
@ -1454,7 +1454,7 @@ as was the case with ``SubfieldBase``.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``django.utils.checksums`` module has been deprecated and will be removed
|
||||
in Django 2.0. The functionality it provided (validating checksum using the
|
||||
in Django 1.10. The functionality it provided (validating checksum using the
|
||||
Luhn algorithm) was undocumented and not used in Django. The module has been
|
||||
moved to the `django-localflavor`_ package (version 1.1+).
|
||||
|
||||
@ -1464,7 +1464,7 @@ moved to the `django-localflavor`_ package (version 1.1+).
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The ``original_content_type_id`` attribute on ``InlineAdminForm`` has been
|
||||
deprecated and will be removed in Django 2.0. Historically, it was used
|
||||
deprecated and will be removed in Django 1.10. Historically, it was used
|
||||
to construct the "view on site" URL. This URL is now accessible using the
|
||||
``absolute_url`` attribute of the form.
|
||||
|
||||
@ -1511,7 +1511,7 @@ for details.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The following functions and classes will no longer accept a ``current_app``
|
||||
parameter to set an URL namespace in Django 2.0:
|
||||
parameter to set an URL namespace in Django 1.10:
|
||||
|
||||
* ``django.shortcuts.render()``
|
||||
* ``django.template.Context()``
|
||||
@ -1526,7 +1526,7 @@ to these functions or classes. If you're using a plain ``Context``, use a
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The following functions will no longer accept the ``dictionary`` and
|
||||
``context_instance`` parameters in Django 2.0:
|
||||
``context_instance`` parameters in Django 1.10:
|
||||
|
||||
* ``django.shortcuts.render()``
|
||||
* ``django.shortcuts.render_to_response()``
|
||||
@ -1544,7 +1544,7 @@ pass a :class:`dict` in the ``context`` parameter instead. If you're passing a
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The following functions will no longer accept a ``dirs`` parameter to override
|
||||
``TEMPLATE_DIRS`` in Django 2.0:
|
||||
``TEMPLATE_DIRS`` in Django 1.10:
|
||||
|
||||
* :func:`django.template.loader.get_template()`
|
||||
* :func:`django.template.loader.select_template()`
|
||||
@ -1576,7 +1576,7 @@ Support for the ``max_length`` argument on custom ``Storage`` classes
|
||||
:meth:`~django.core.files.storage.Storage.get_available_name` and/or
|
||||
:meth:`~django.core.files.storage.Storage.save` if they override either method.
|
||||
Support for storages that do not accept this argument will be removed in
|
||||
Django 2.0.
|
||||
Django 1.10.
|
||||
|
||||
``qn`` replaced by ``compiler``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -1608,7 +1608,7 @@ added in Django 1.7. In Django 1.7.2, its functionality was moved to
|
||||
``'django.contrib.auth.middleware.SessionAuthenticationMiddleware'`` appears in
|
||||
:setting:`MIDDLEWARE_CLASSES`.
|
||||
|
||||
In Django 2.0, session verification will be enabled regardless of whether or not
|
||||
In Django 1.10, session verification will be enabled regardless of whether or not
|
||||
``SessionAuthenticationMiddleware`` is enabled (at which point
|
||||
``SessionAuthenticationMiddleware`` will have no significance). You can add it
|
||||
to your ``MIDDLEWARE_CLASSES`` sometime before then to opt-in. Please read the
|
||||
@ -1629,7 +1629,7 @@ of ``Field.rel``. The latter is an instance of
|
||||
``django.db.models.fields.related.ForeignObjectRel`` which replaces
|
||||
``django.db.models.related.RelatedObject``. The ``django.db.models.related``
|
||||
module has been removed and the ``Field.related`` attribute will be removed in
|
||||
Django 2.0.
|
||||
Django 1.10.
|
||||
|
||||
``ssi`` template tag
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
@ -1637,7 +1637,7 @@ Django 2.0.
|
||||
The :ttag:`ssi` template tag allows files to be included in a template by
|
||||
absolute path. This is of limited use in most deployment situations, and
|
||||
the :ttag:`include` tag often makes more sense. This tag is now deprecated and
|
||||
will be removed in Django 2.0.
|
||||
will be removed in Django 1.10.
|
||||
|
||||
``=`` as comparison operator in ``if`` template tag
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -1650,7 +1650,7 @@ testing was undocumented and untested. It's now deprecated in favor of ``==``.
|
||||
|
||||
The legacy ``%(<foo>)s`` syntax in :attr:`ModelFormMixin.success_url
|
||||
<django.views.generic.edit.ModelFormMixin.success_url>` is deprecated and
|
||||
will be removed in Django 2.0.
|
||||
will be removed in Django 1.10.
|
||||
|
||||
``GeoQuerySet`` aggregate methods
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -643,7 +643,7 @@ queries, you should turn them into naive datetimes in UTC::
|
||||
param = timezone.make_naive(param, timezone.utc)
|
||||
|
||||
If you fail to do so, Django 1.9 and 2.0 will perform the conversion like
|
||||
earlier versions but emit a deprecation warning. Django 2.1 won't perform any
|
||||
earlier versions but emit a deprecation warning. Django 2.0 won't perform any
|
||||
conversion, which may result in data corruption.
|
||||
|
||||
If you're reading :class:`~datetime.datetime` values from the results, they
|
||||
@ -839,7 +839,7 @@ Miscellaneous
|
||||
|
||||
* The ``check_aggregate_support()`` method of
|
||||
``django.db.backends.base.BaseDatabaseOperations`` has been deprecated and
|
||||
will be removed in Django 2.1. The more general ``check_expression_support()``
|
||||
will be removed in Django 2.0. The more general ``check_expression_support()``
|
||||
should be used instead.
|
||||
|
||||
* ``django.forms.extras`` is deprecated. You can find
|
||||
|
@ -764,7 +764,7 @@ Session invalidation on password change
|
||||
is enabled in :setting:`MIDDLEWARE_CLASSES`. It's included if
|
||||
``settings.py`` was generated by :djadmin:`startproject` on Django ≥ 1.7.
|
||||
|
||||
Session verification will become mandatory in Django 2.0 regardless of
|
||||
Session verification will become mandatory in Django 1.10 regardless of
|
||||
whether or not ``SessionAuthenticationMiddleware`` is enabled. If you have
|
||||
a pre-1.7 project or one generated using a template that doesn't include
|
||||
``SessionAuthenticationMiddleware``, consider enabling it before then after
|
||||
@ -1215,7 +1215,7 @@ implementation details see :ref:`using-the-views`.
|
||||
.. deprecated:: 1.8
|
||||
|
||||
The ``is_admin_site`` argument is deprecated and will be removed in
|
||||
Django 2.0.
|
||||
Django 1.10.
|
||||
|
||||
**Template context:**
|
||||
|
||||
|
@ -49,7 +49,7 @@ Optional arguments
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
The ``context`` argument used to be called ``dictionary``. That name
|
||||
is deprecated in Django 1.8 and will be removed in Django 2.0.
|
||||
is deprecated in Django 1.8 and will be removed in Django 1.10.
|
||||
|
||||
``context_instance``
|
||||
The context instance to render the template with. By default, the template
|
||||
@ -142,7 +142,7 @@ Optional arguments
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
The ``context`` argument used to be called ``dictionary``. That name
|
||||
is deprecated in Django 1.8 and will be removed in Django 2.0.
|
||||
is deprecated in Django 1.8 and will be removed in Django 1.10.
|
||||
|
||||
``context_instance``
|
||||
The context instance to render the template with. By default, the template
|
||||
|
@ -1267,7 +1267,7 @@ Language prefix in URL patterns
|
||||
.. deprecated:: 1.8
|
||||
|
||||
The ``prefix`` argument to ``i18n_patterns()`` has been deprecated and will
|
||||
not be supported in Django 2.0. Simply pass a list of
|
||||
not be supported in Django 1.10. Simply pass a list of
|
||||
:func:`django.conf.urls.url` instances instead.
|
||||
|
||||
This function can be used in your root URLconf and Django will automatically
|
||||
|
@ -285,4 +285,4 @@ may be ``None`` if ``dispatch_uid`` is used to identify the receiver.
|
||||
.. deprecated:: 1.9
|
||||
|
||||
The ``weak`` argument is deprecated as it has no effect. It will be removed
|
||||
in Django 2.1.
|
||||
in Django 2.0.
|
||||
|
@ -286,7 +286,7 @@ templates, Django provides a shortcut function which automates the process.
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
The ``context`` argument used to be called ``dictionary``. That name
|
||||
is deprecated in Django 1.8 and will be removed in Django 2.0.
|
||||
is deprecated in Django 1.8 and will be removed in Django 1.10.
|
||||
|
||||
``context`` is now optional. An empty context will be used if it
|
||||
isn't provided.
|
||||
|
@ -433,7 +433,7 @@ class TestInlineAdminForm(TestCase):
|
||||
self.assertEqual(
|
||||
msg,
|
||||
'InlineAdminForm.original_content_type_id is deprecated and will be '
|
||||
'removed in Django 2.0. If you were using this attribute to construct '
|
||||
'removed in Django 1.10. If you were using this attribute to construct '
|
||||
'the "view on site" URL, use the `absolute_url` attribute instead.'
|
||||
)
|
||||
self.assertEqual(iaf2.original_content_type_id, poll_ct.id)
|
||||
|
@ -13,7 +13,7 @@ from django.db.models import (
|
||||
from django.test import TestCase, ignore_warnings
|
||||
from django.test.utils import Approximate, CaptureQueriesContext
|
||||
from django.utils import six, timezone
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from .models import Author, Book, Publisher, Store
|
||||
|
||||
@ -1068,7 +1068,7 @@ class AggregateTestCase(TestCase):
|
||||
self.assertQuerysetEqual(
|
||||
qs2, [1, 3], lambda v: v.num_awards)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_backwards_compatibility(self):
|
||||
from django.db.models.sql import aggregates as sql_aggregates
|
||||
|
||||
|
@ -28,7 +28,7 @@ from django.test import (
|
||||
TestCase, ignore_warnings, modify_settings, override_settings,
|
||||
)
|
||||
from django.test.utils import patch_logger
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.http import urlquote
|
||||
from django.utils.six.moves.urllib.parse import ParseResult, urlparse
|
||||
@ -197,7 +197,7 @@ class PasswordResetTest(AuthViewsTestCase):
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
self.assertEqual("staffmember@example.com", mail.outbox[0].from_email)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
@override_settings(ALLOWED_HOSTS=['adminsite.com'])
|
||||
def test_admin_reset(self):
|
||||
"If the reset view is marked as being for admin, the HTTP_HOST header is used for a domain override."
|
||||
|
@ -195,5 +195,5 @@ class DeprecatingSimpleTestCaseUrls(unittest.TestCase):
|
||||
msg = force_text(recorded.pop().message)
|
||||
self.assertEqual(msg,
|
||||
"SimpleTestCase.urls is deprecated and will be removed in "
|
||||
"Django 2.0. Use @override_settings(ROOT_URLCONF=...) "
|
||||
"Django 1.10. Use @override_settings(ROOT_URLCONF=...) "
|
||||
"in TempTestCase instead.")
|
||||
|
@ -5,14 +5,14 @@ import warnings
|
||||
|
||||
from django.db import models
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
|
||||
# Catch warning about subfieldbase -- remove in Django 2.0
|
||||
# Catch warning about subfieldbase -- remove in Django 1.10
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
'SubfieldBase has been deprecated. Use Field.from_db_value instead.',
|
||||
RemovedInDjango20Warning
|
||||
RemovedInDjango110Warning
|
||||
)
|
||||
|
||||
|
||||
|
@ -568,13 +568,13 @@ class FileFieldStorageTests(TestCase):
|
||||
str(warns[0].message),
|
||||
'Backwards compatibility for storage backends without support for '
|
||||
'the `max_length` argument in Storage.save() will be removed in '
|
||||
'Django 2.0.'
|
||||
'Django 1.10.'
|
||||
)
|
||||
self.assertEqual(
|
||||
str(warns[1].message),
|
||||
'Backwards compatibility for storage backends without support for '
|
||||
'the `max_length` argument in Storage.get_available_name() will '
|
||||
'be removed in Django 2.0.'
|
||||
'be removed in Django 1.10.'
|
||||
)
|
||||
self.assertEqual(obj.old_style.name, 'tests/deprecated_storage_test.txt')
|
||||
self.assertEqual(obj.old_style.read(), b'Same Content')
|
||||
|
@ -47,7 +47,7 @@ from django.forms import (
|
||||
from django.test import SimpleTestCase, ignore_warnings
|
||||
from django.utils import formats, six, translation
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.duration import duration_string
|
||||
|
||||
try:
|
||||
@ -513,7 +513,7 @@ class FieldsTests(SimpleTestCase):
|
||||
f = DateField()
|
||||
self.assertRaisesMessage(ValidationError, "'Enter a valid date.'", f.clean, 'a\x00b')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning) # for _has_changed
|
||||
@ignore_warnings(category=RemovedInDjango110Warning) # for _has_changed
|
||||
def test_datefield_changed(self):
|
||||
format = '%d/%m/%Y'
|
||||
f = DateField(input_formats=[format])
|
||||
@ -692,7 +692,7 @@ class FieldsTests(SimpleTestCase):
|
||||
self.assertRaisesMessage(ValidationError, "'Enter a valid value.'", f.clean, ' 2A2')
|
||||
self.assertRaisesMessage(ValidationError, "'Enter a valid value.'", f.clean, '2A2 ')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning) # error_message deprecation
|
||||
@ignore_warnings(category=RemovedInDjango110Warning) # error_message deprecation
|
||||
def test_regexfield_4(self):
|
||||
f = RegexField('^[0-9][0-9][0-9][0-9]$', error_message='Enter a four-digit number.')
|
||||
self.assertEqual('1234', f.clean('1234'))
|
||||
|
@ -9,7 +9,7 @@ from django.test import (
|
||||
SimpleTestCase, TestCase, ignore_warnings, override_settings,
|
||||
)
|
||||
from django.test.client import RequestFactory
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.views.generic.base import View
|
||||
from django.views.generic.edit import CreateView, FormMixin, ModelFormMixin
|
||||
|
||||
@ -72,7 +72,7 @@ class FormMixinTests(SimpleTestCase):
|
||||
def get_form(self, form_class):
|
||||
return form_class(**self.get_form_kwargs())
|
||||
self.assertEqual(len(w), 1)
|
||||
self.assertEqual(w[0].category, RemovedInDjango20Warning)
|
||||
self.assertEqual(w[0].category, RemovedInDjango110Warning)
|
||||
self.assertEqual(
|
||||
str(w[0].message),
|
||||
'`generic_views.test_edit.MissingDefaultValue.get_form` method '
|
||||
@ -152,7 +152,7 @@ class CreateViewTests(TestCase):
|
||||
self.assertRedirects(res, '/edit/authors/create/')
|
||||
self.assertQuerysetEqual(Author.objects.all(), ['<Author: Randall Munroe>'])
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_create_with_interpolated_redirect(self):
|
||||
res = self.client.post(
|
||||
'/edit/authors/create/interpolate_redirect/',
|
||||
@ -292,7 +292,7 @@ class UpdateViewTests(TestCase):
|
||||
self.assertRedirects(res, '/edit/authors/create/')
|
||||
self.assertQuerysetEqual(Author.objects.all(), ['<Author: Randall Munroe (author of xkcd)>'])
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_update_with_interpolated_redirect(self):
|
||||
a = Author.objects.create(
|
||||
name='Randall Munroe',
|
||||
@ -399,7 +399,7 @@ class DeleteViewTests(TestCase):
|
||||
self.assertRedirects(res, '/edit/authors/create/')
|
||||
self.assertQuerysetEqual(Author.objects.all(), [])
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_delete_with_interpolated_redirect(self):
|
||||
a = Author.objects.create(**{'name': 'Randall Munroe', 'slug': 'randall-munroe'})
|
||||
res = self.client.post('/edit/author/%d/delete/interpolate_redirect/' % a.pk)
|
||||
|
@ -8,7 +8,7 @@ from django.contrib.gis.measure import D # alias for Distance
|
||||
from django.db import connection
|
||||
from django.db.models import Q
|
||||
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from ..utils import no_oracle, oracle, postgis, spatialite
|
||||
from .models import (
|
||||
@ -97,7 +97,7 @@ class DistanceTest(TestCase):
|
||||
self.assertListEqual(au_cities, self.get_names(qs.filter(point__dwithin=(self.au_pnt, dist))))
|
||||
|
||||
@skipUnlessDBFeature("has_distance_method")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_distance_projected(self):
|
||||
"""
|
||||
Test the `distance` GeoQuerySet method on projected coordinate systems.
|
||||
@ -141,7 +141,7 @@ class DistanceTest(TestCase):
|
||||
self.assertAlmostEqual(ft_distances[i], c.distance.survey_ft, tol)
|
||||
|
||||
@skipUnlessDBFeature("has_distance_method", "supports_distance_geodetic")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_distance_geodetic(self):
|
||||
"""
|
||||
Test the `distance` GeoQuerySet method on geodetic coordinate systems.
|
||||
@ -203,7 +203,7 @@ class DistanceTest(TestCase):
|
||||
|
||||
@no_oracle # Oracle already handles geographic distance calculation.
|
||||
@skipUnlessDBFeature("has_distance_method")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_distance_transform(self):
|
||||
"""
|
||||
Test the `distance` GeoQuerySet method used with `transform` on a geographic field.
|
||||
@ -324,7 +324,7 @@ class DistanceTest(TestCase):
|
||||
self.assertEqual(cities, ['Adelaide', 'Hobart', 'Shellharbour', 'Thirroul'])
|
||||
|
||||
@skipUnlessDBFeature("has_area_method")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_area(self):
|
||||
"""
|
||||
Test the `area` GeoQuerySet method.
|
||||
@ -338,7 +338,7 @@ class DistanceTest(TestCase):
|
||||
self.assertAlmostEqual(area_sq_m[i], z.area.sq_m, tol)
|
||||
|
||||
@skipUnlessDBFeature("has_length_method")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_length(self):
|
||||
"""
|
||||
Test the `length` GeoQuerySet method.
|
||||
@ -362,7 +362,7 @@ class DistanceTest(TestCase):
|
||||
self.assertAlmostEqual(len_m2, i10.length.m, 2)
|
||||
|
||||
@skipUnlessDBFeature("has_perimeter_method")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_perimeter(self):
|
||||
"""
|
||||
Test the `perimeter` GeoQuerySet method.
|
||||
@ -379,7 +379,7 @@ class DistanceTest(TestCase):
|
||||
self.assertEqual(0, c.perim.m)
|
||||
|
||||
@skipUnlessDBFeature("has_area_method", "has_distance_method")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_measurement_null_fields(self):
|
||||
"""
|
||||
Test the measurement GeoQuerySet methods on fields with NULL values.
|
||||
@ -394,7 +394,7 @@ class DistanceTest(TestCase):
|
||||
self.assertIsNone(z.area)
|
||||
|
||||
@skipUnlessDBFeature("has_distance_method")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_distance_order_by(self):
|
||||
qs = SouthTexasCity.objects.distance(Point(3, 3)).order_by(
|
||||
'distance'
|
||||
|
@ -13,7 +13,7 @@ from django.contrib.gis.geos import GEOSGeometry, LineString, Point, Polygon
|
||||
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import (
|
||||
RemovedInDjango20Warning, RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning, RemovedInDjango110Warning,
|
||||
)
|
||||
|
||||
from .models import (
|
||||
@ -173,7 +173,7 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase):
|
||||
lm.save()
|
||||
self.assertEqual(3, MultiPoint3D.objects.count())
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_kml(self):
|
||||
"""
|
||||
Test GeoQuerySet.kml() with Z values.
|
||||
@ -185,7 +185,7 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase):
|
||||
ref_kml_regex = re.compile(r'^<Point><coordinates>-95.363\d+,29.763\d+,18</coordinates></Point>$')
|
||||
self.assertTrue(ref_kml_regex.match(h.kml))
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_geojson(self):
|
||||
"""
|
||||
Test GeoQuerySet.geojson() with Z values.
|
||||
@ -217,7 +217,7 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase):
|
||||
self.assertSetEqual({p.ewkt for p in ref_union}, {p.ewkt for p in union})
|
||||
|
||||
@skipUnlessDBFeature("supports_3d_functions")
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_extent(self):
|
||||
"""
|
||||
Testing the Extent3D aggregate for 3D models.
|
||||
@ -237,7 +237,7 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase):
|
||||
self.assertIsNone(City3D.objects.none().extent3d())
|
||||
self.assertIsNone(City3D.objects.none().aggregate(Extent3D('point'))['point__extent3d'])
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@skipUnlessDBFeature("supports_3d_functions")
|
||||
def test_perimeter(self):
|
||||
"""
|
||||
@ -256,7 +256,7 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase):
|
||||
Polygon3D.objects.perimeter().get(name='3D BBox').perimeter.m,
|
||||
tol)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@skipUnlessDBFeature("supports_3d_functions")
|
||||
def test_length(self):
|
||||
"""
|
||||
@ -290,7 +290,7 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase):
|
||||
InterstateProj3D.objects.length().get(name='I-45').length.m,
|
||||
tol)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@skipUnlessDBFeature("supports_3d_functions")
|
||||
def test_scale(self):
|
||||
"""
|
||||
@ -303,7 +303,7 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase):
|
||||
for city in City3D.objects.scale(1.0, 1.0, zscale):
|
||||
self.assertEqual(city_dict[city.name][2] * zscale, city.scale.z)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@skipUnlessDBFeature("supports_3d_functions")
|
||||
def test_translate(self):
|
||||
"""
|
||||
|
@ -10,7 +10,7 @@ from django.test import (
|
||||
TestCase, ignore_warnings, modify_settings, override_settings,
|
||||
skipUnlessDBFeature,
|
||||
)
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from .models import City, Country
|
||||
|
||||
@ -30,7 +30,7 @@ class GeoSitemapTest(TestCase):
|
||||
expected = set(expected)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_geositemap_kml(self):
|
||||
"Tests KML/KMZ geographic sitemaps."
|
||||
for kml_type in ('kml', 'kmz'):
|
||||
|
@ -14,7 +14,7 @@ from django.db import connection
|
||||
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import (
|
||||
RemovedInDjango20Warning, RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning, RemovedInDjango110Warning,
|
||||
)
|
||||
|
||||
from ..utils import no_oracle, oracle, postgis, spatialite
|
||||
@ -435,7 +435,7 @@ class GeoLookupTest(TestCase):
|
||||
|
||||
|
||||
@skipUnlessDBFeature("gis_enabled")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
class GeoQuerySetTest(TestCase):
|
||||
fixtures = ['initial']
|
||||
|
||||
@ -493,7 +493,7 @@ class GeoQuerySetTest(TestCase):
|
||||
self.assertIsInstance(country.envelope, Polygon)
|
||||
|
||||
@skipUnlessDBFeature("supports_extent_aggr")
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_extent(self):
|
||||
"""
|
||||
Testing the (deprecated) `extent` GeoQuerySet method and the Extent
|
||||
@ -651,7 +651,7 @@ class GeoQuerySetTest(TestCase):
|
||||
for ptown in [ptown1, ptown2]:
|
||||
self.assertEqual('<Point><coordinates>-104.609252,38.255001</coordinates></Point>', ptown.kml)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_make_line(self):
|
||||
"""
|
||||
Testing the (deprecated) `make_line` GeoQuerySet method and the MakeLine
|
||||
@ -863,7 +863,7 @@ class GeoQuerySetTest(TestCase):
|
||||
# but this seems unexpected and should be investigated to determine the cause.
|
||||
@skipUnlessDBFeature("has_unionagg_method")
|
||||
@no_oracle
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_unionagg(self):
|
||||
"""
|
||||
Testing the (deprecated) `unionagg` (aggregate union) GeoQuerySet method
|
||||
|
@ -11,7 +11,7 @@ from django.contrib.gis.gdal import HAS_GDAL
|
||||
from django.contrib.gis.measure import D
|
||||
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import RemovedInDjango21Warning
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
|
||||
from ..utils import oracle, postgis
|
||||
from .models import City, County, Zipcode
|
||||
@ -41,7 +41,7 @@ class GeographyTest(TestCase):
|
||||
self.assertEqual(['Dallas', 'Houston', 'Oklahoma City'], cities)
|
||||
|
||||
@skipUnlessDBFeature("has_distance_method", "supports_distance_geodetic")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test03_distance_method(self):
|
||||
"Testing GeoQuerySet.distance() support on non-point geography fields."
|
||||
# `GeoQuerySet.distance` is not allowed geometry fields.
|
||||
@ -94,7 +94,7 @@ class GeographyTest(TestCase):
|
||||
self.assertEqual(state, c.state)
|
||||
|
||||
@skipUnlessDBFeature("has_area_method", "supports_distance_geodetic")
|
||||
@ignore_warnings(category=RemovedInDjango21Warning)
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test06_geography_area(self):
|
||||
"Testing that Area calculations work on geography columns."
|
||||
# SELECT ST_Area(poly) FROM geogapp_zipcode WHERE code='77002';
|
||||
|
@ -7,7 +7,7 @@ from django.db import connection
|
||||
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
|
||||
from django.test.utils import override_settings
|
||||
from django.utils import timezone
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from ..utils import no_oracle
|
||||
from .models import (
|
||||
@ -64,7 +64,7 @@ class RelatedGeoModelTest(TestCase):
|
||||
check_pnt(GEOSGeometry(wkt, srid), qs[0].location.point)
|
||||
|
||||
@skipUnlessDBFeature("supports_extent_aggr")
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_related_extent_aggregate(self):
|
||||
"Testing the `extent` GeoQuerySet aggregates on related geographic models."
|
||||
# This combines the Extent and Union aggregates into one query
|
||||
@ -98,7 +98,7 @@ class RelatedGeoModelTest(TestCase):
|
||||
)
|
||||
|
||||
@skipUnlessDBFeature("has_unionagg_method")
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_related_union_aggregate(self):
|
||||
"Testing the `unionagg` GeoQuerySet aggregates on related geographic models."
|
||||
# This combines the Extent and Union aggregates into one query
|
||||
@ -291,7 +291,7 @@ class RelatedGeoModelTest(TestCase):
|
||||
self.assertIsNone(b.author)
|
||||
|
||||
@skipUnlessDBFeature("supports_collect_aggr")
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_collect(self):
|
||||
"""
|
||||
Testing the (deprecated) `collect` GeoQuerySet method and `Collect`
|
||||
|
@ -3,12 +3,12 @@ from __future__ import unicode_literals
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.http import HttpResponse, StreamingHttpResponse
|
||||
from django.test import ignore_warnings
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
# test deprecated version of i18n_patterns() function (with prefix). Remove it
|
||||
# and convert to list of urls() in Django 2.0
|
||||
i18n_patterns = ignore_warnings(category=RemovedInDjango20Warning)(i18n_patterns)
|
||||
# and convert to list of urls() in Django 1.10
|
||||
i18n_patterns = ignore_warnings(category=RemovedInDjango110Warning)(i18n_patterns)
|
||||
|
||||
urlpatterns = i18n_patterns('',
|
||||
(r'^simple/$', lambda r: HttpResponse()),
|
||||
|
@ -10,7 +10,7 @@ from django.core.management import CommandError, call_command
|
||||
from django.db import DatabaseError, connection, models
|
||||
from django.test import ignore_warnings, mock, override_settings
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from .models import UnicodeModel, UnserializableModel
|
||||
@ -117,7 +117,7 @@ class MigrateTests(MigrationTestBase):
|
||||
with self.assertRaisesMessage(CommandError, "Conflicting migrations detected"):
|
||||
call_command("migrate", "migrations")
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
@override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
|
||||
def test_migrate_list(self):
|
||||
"""
|
||||
|
@ -4,7 +4,7 @@ from django import test
|
||||
from django.contrib.contenttypes.fields import GenericRelation
|
||||
from django.core.exceptions import FieldDoesNotExist
|
||||
from django.db.models.fields import CharField, related
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from .models import BasePerson, Person
|
||||
from .results import TEST_RESULTS
|
||||
@ -26,11 +26,11 @@ class M2MTests(OptionsBaseTests):
|
||||
with warnings.catch_warnings(record=True) as warning:
|
||||
warnings.simplefilter("always")
|
||||
models = [model for field, model in model._meta.get_m2m_with_model()]
|
||||
self.assertEqual([RemovedInDjango20Warning], [w.message.__class__ for w in warning])
|
||||
self.assertEqual([RemovedInDjango110Warning], [w.message.__class__ for w in warning])
|
||||
self.assertEqual(models, expected_result)
|
||||
|
||||
|
||||
@test.ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@test.ignore_warnings(category=RemovedInDjango110Warning)
|
||||
class RelatedObjectsTests(OptionsBaseTests):
|
||||
key_name = lambda self, r: r[0]
|
||||
|
||||
@ -83,7 +83,7 @@ class RelatedObjectsTests(OptionsBaseTests):
|
||||
)
|
||||
|
||||
|
||||
@test.ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@test.ignore_warnings(category=RemovedInDjango110Warning)
|
||||
class RelatedM2MTests(OptionsBaseTests):
|
||||
|
||||
def test_related_m2m_with_model(self):
|
||||
@ -111,7 +111,7 @@ class RelatedM2MTests(OptionsBaseTests):
|
||||
self.assertIn('friends_inherited_rel_+', [o.field.related_query_name() for o in related_m2m])
|
||||
|
||||
|
||||
@test.ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@test.ignore_warnings(category=RemovedInDjango110Warning)
|
||||
class GetFieldByNameTests(OptionsBaseTests):
|
||||
|
||||
def test_get_data_field(self):
|
||||
@ -149,15 +149,15 @@ class GetFieldByNameTests(OptionsBaseTests):
|
||||
)
|
||||
self.assertEqual(Person._meta.get_field('m2m_base', many_to_many=True).name, 'm2m_base')
|
||||
|
||||
# 2 RemovedInDjango20Warning messages should be raised, one for each call of get_field()
|
||||
# 2 RemovedInDjango110Warning messages should be raised, one for each call of get_field()
|
||||
# with the 'many_to_many' argument.
|
||||
self.assertEqual(
|
||||
[RemovedInDjango20Warning, RemovedInDjango20Warning],
|
||||
[RemovedInDjango110Warning, RemovedInDjango110Warning],
|
||||
[w.message.__class__ for w in warning]
|
||||
)
|
||||
|
||||
|
||||
@test.ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@test.ignore_warnings(category=RemovedInDjango110Warning)
|
||||
class GetAllFieldNamesTestCase(OptionsBaseTests):
|
||||
|
||||
def test_get_all_field_names(self):
|
||||
|
@ -931,7 +931,7 @@ class RouterTestCase(TestCase):
|
||||
def allow_migrate(self, db, model):
|
||||
"""
|
||||
Deprecated allow_migrate signature should trigger
|
||||
RemovedInDjango20Warning.
|
||||
RemovedInDjango110Warning.
|
||||
"""
|
||||
assert db == 'default'
|
||||
assert model is User
|
||||
@ -945,7 +945,7 @@ class RouterTestCase(TestCase):
|
||||
"The signature of allow_migrate has changed from "
|
||||
"allow_migrate(self, db, model) to "
|
||||
"allow_migrate(self, db, app_label, model_name=None, **hints). "
|
||||
"Support for the old signature will be removed in Django 2.0."
|
||||
"Support for the old signature will be removed in Django 1.10."
|
||||
)
|
||||
|
||||
self.assertTrue(router.allow_migrate_model('default', User))
|
||||
|
@ -5,7 +5,7 @@ from django.core.urlresolvers import NoReverseMatch, reverse_lazy
|
||||
from django.shortcuts import resolve_url
|
||||
from django.test import SimpleTestCase, ignore_warnings, override_settings
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from .models import UnimportantThing
|
||||
|
||||
@ -66,7 +66,7 @@ class ResolveUrlTests(SimpleTestCase):
|
||||
self.assertIsInstance(resolved_url, six.text_type)
|
||||
self.assertEqual('/accounts/logout/', resolved_url)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_valid_view_name(self):
|
||||
"""
|
||||
Tests that passing a view function to ``resolve_url`` will result in
|
||||
|
@ -17,12 +17,12 @@ from django.test.utils import get_runner
|
||||
from django.utils import six
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import (
|
||||
RemovedInDjango20Warning, RemovedInDjango21Warning,
|
||||
RemovedInDjango20Warning, RemovedInDjango110Warning,
|
||||
)
|
||||
from django.utils.log import DEFAULT_LOGGING
|
||||
|
||||
warnings.simplefilter("error", RemovedInDjango110Warning)
|
||||
warnings.simplefilter("error", RemovedInDjango20Warning)
|
||||
warnings.simplefilter("error", RemovedInDjango21Warning)
|
||||
|
||||
RUNTESTS_DIR = os.path.abspath(os.path.dirname(upath(__file__)))
|
||||
|
||||
@ -107,7 +107,7 @@ def setup(verbosity, test_labels):
|
||||
state = {
|
||||
'INSTALLED_APPS': settings.INSTALLED_APPS,
|
||||
'ROOT_URLCONF': getattr(settings, "ROOT_URLCONF", ""),
|
||||
# Remove the following line in Django 2.0.
|
||||
# Remove the following line in Django 1.10.
|
||||
'TEMPLATE_DIRS': settings.TEMPLATE_DIRS,
|
||||
'TEMPLATES': settings.TEMPLATES,
|
||||
'LANGUAGE_CODE': settings.LANGUAGE_CODE,
|
||||
@ -121,7 +121,7 @@ def setup(verbosity, test_labels):
|
||||
settings.ROOT_URLCONF = 'urls'
|
||||
settings.STATIC_URL = '/static/'
|
||||
settings.STATIC_ROOT = os.path.join(TMPDIR, 'static')
|
||||
# Remove the following line in Django 2.0.
|
||||
# Remove the following line in Django 1.10.
|
||||
settings.TEMPLATE_DIRS = [TEMPLATE_DIR]
|
||||
settings.TEMPLATES = [{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
@ -161,13 +161,13 @@ def setup(verbosity, test_labels):
|
||||
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
'django.contrib.webdesign will be removed in Django 2.0.',
|
||||
RemovedInDjango20Warning
|
||||
'django.contrib.webdesign will be removed in Django 1.10.',
|
||||
RemovedInDjango110Warning
|
||||
)
|
||||
warnings.filterwarnings(
|
||||
'ignore',
|
||||
'The GeoManager class is deprecated.',
|
||||
RemovedInDjango21Warning
|
||||
RemovedInDjango20Warning
|
||||
)
|
||||
|
||||
# Load all the ALWAYS_INSTALLED_APPS.
|
||||
|
@ -487,7 +487,7 @@ class TestSessionVerification(unittest.TestCase):
|
||||
Settings('fake_settings_module')
|
||||
self.assertEqual(
|
||||
force_text(warn[0].message),
|
||||
"Session verification will become mandatory in Django 2.0. "
|
||||
"Session verification will become mandatory in Django 1.10. "
|
||||
"Please add 'django.contrib.auth.middleware.SessionAuthenticationMiddleware' "
|
||||
"to your MIDDLEWARE_CLASSES setting when you are ready to opt-in after "
|
||||
"reading the upgrade considerations in the 1.8 release notes.",
|
||||
|
@ -1,6 +1,6 @@
|
||||
from django.test import SimpleTestCase, ignore_warnings, override_settings
|
||||
from django.test.utils import require_jinja2
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
|
||||
@override_settings(
|
||||
@ -19,7 +19,7 @@ class ShortcutTests(SimpleTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.content, b'FOO.BAR..\n')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_render_to_response_with_request_context(self):
|
||||
response = self.client.get('/render_to_response/request_context/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@ -32,7 +32,7 @@ class ShortcutTests(SimpleTestCase):
|
||||
self.assertEqual(response.content, b'FOO.BAR..\n')
|
||||
self.assertEqual(response['Content-Type'], 'application/x-rendertest')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_render_to_response_with_dirs(self):
|
||||
response = self.client.get('/render_to_response/dirs/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@ -53,7 +53,7 @@ class ShortcutTests(SimpleTestCase):
|
||||
response = self.client.get('/render_to_response/using/?using=jinja2')
|
||||
self.assertEqual(response.content, b'Jinja2\n')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_render_to_response_with_context_instance_misuse(self):
|
||||
"""
|
||||
For backwards-compatibility, ensure that it's possible to pass a
|
||||
@ -75,7 +75,7 @@ class ShortcutTests(SimpleTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.content, b'FOO.BAR../render/multiple_templates/\n')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_render_with_base_context(self):
|
||||
response = self.client.get('/render/base_context/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@ -102,19 +102,19 @@ class ShortcutTests(SimpleTestCase):
|
||||
response = self.client.get('/render/using/?using=jinja2')
|
||||
self.assertEqual(response.content, b'Jinja2\n')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_render_with_current_app(self):
|
||||
response = self.client.get('/render/current_app/')
|
||||
self.assertEqual(response.context.request.current_app, "foobar_app")
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_render_with_dirs(self):
|
||||
response = self.client.get('/render/dirs/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.content, b'spam eggs\n')
|
||||
self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_render_with_current_app_conflict(self):
|
||||
with self.assertRaises(ValueError):
|
||||
self.client.get('/render/current_app_conflict/')
|
||||
|
@ -11,7 +11,7 @@ from django.contrib.sites.models import Site
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.test import ignore_warnings, modify_settings, override_settings
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.formats import localize
|
||||
from django.utils.translation import activate, deactivate
|
||||
|
||||
@ -21,7 +21,7 @@ from .models import TestModel
|
||||
|
||||
class HTTPSitemapTests(SitemapTestsBase):
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_simple_sitemap_index(self):
|
||||
"A simple sitemap index can be rendered"
|
||||
# The URL for views.sitemap in tests/urls/http.py has been updated
|
||||
@ -38,7 +38,7 @@ class HTTPSitemapTests(SitemapTestsBase):
|
||||
""" % self.base_url
|
||||
self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
@override_settings(TEMPLATES=[{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(os.path.dirname(upath(__file__)), 'templates')],
|
||||
@ -194,7 +194,7 @@ class HTTPSitemapTests(SitemapTestsBase):
|
||||
""" % self.base_url
|
||||
self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_x_robots_sitemap(self):
|
||||
# The URL for views.sitemap in tests/urls/http.py has been updated
|
||||
# with a name but since reversing by Python path is tried first
|
||||
|
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||
from datetime import date
|
||||
|
||||
from django.test import ignore_warnings, override_settings
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from .base import SitemapTestsBase
|
||||
|
||||
@ -12,7 +12,7 @@ from .base import SitemapTestsBase
|
||||
class HTTPSSitemapTests(SitemapTestsBase):
|
||||
protocol = 'https'
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_secure_sitemap_index(self):
|
||||
"A secure sitemap index can be rendered"
|
||||
# The URL for views.sitemap in tests/urls/https.py has been updated
|
||||
@ -44,7 +44,7 @@ class HTTPSSitemapTests(SitemapTestsBase):
|
||||
class HTTPSDetectionSitemapTests(SitemapTestsBase):
|
||||
extra = {'wsgi.url_scheme': 'https'}
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
@ignore_warnings(category=RemovedInDjango110Warning)
|
||||
def test_sitemap_index_with_https_request(self):
|
||||
"A sitemap index requested in HTTPS is rendered with HTTPS links"
|
||||
# The URL for views.sitemap in tests/urls/https.py has been updated
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user