{"title":"Django废弃时间表","version":"6.0","locale":"zh-hans","docname":"internals/deprecation","url":"/zh-hans/6.0/internals/deprecation/","canonical":"https://djangodocs.dev/zh-hans/6.0/internals/deprecation/","summary":"本文档概述了根据弃用政策 deprecation policy 弃用后，各个Django版本将以向后不兼容的方式删除或更改的情况。 通常，可以在之前的两个版本的发行说明中找到有关每个项目的更多详细信息。 7.0 Link to this heading # See the Django 6.0 release notes…","html":"<h1>Django废弃时间表<a class=\"heading-anchor\" href=\"#django-deprecation-timeline\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>本文档概述了根据弃用政策 <a class=\"reference internal\" href=\"/zh-hans/6.0/internals/release-process/#internal-release-deprecation-policy\"><span class=\"std std-ref\">deprecation policy</span></a> 弃用后，各个Django版本将以向后不兼容的方式删除或更改的情况。 通常，可以在之前的两个版本的发行说明中找到有关每个项目的更多详细信息。</p>\n<section id=\"deprecation-removed-in-7-0\">\n<span id=\"id1\"></span><h2>7.0<a class=\"heading-anchor\" href=\"#deprecation-removed-in-7-0\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>See the <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/6.0/#deprecated-features-6-0\"><span class=\"std std-ref\">Django 6.0 release notes</span></a> for more\ndetails on these changes.</p>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\">serialize</code> keyword argument of\n<code class=\"docutils literal notranslate\">BaseDatabaseCreation.create_test_db()</code> will be removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">django.contrib.postgres.aggregates.StringAgg</code> class will be removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">django.contrib.postgres.aggregates.mixins.OrderableAggMixin</code> class\nwill be removed.</p></li>\n<li><p>The default protocol in <code class=\"docutils literal notranslate\">urlize</code> and <code class=\"docutils literal notranslate\">urlizetrunc</code> template filters will\nchange from HTTP to HTTPS.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">URLIZE_ASSUME_HTTPS</code> transitional setting will be removed.</p></li>\n<li><p>Using a percent sign in a column alias or annotation will raise\n<code class=\"docutils literal notranslate\">ValueError</code>.</p></li>\n<li><p>Support for setting the <code class=\"docutils literal notranslate\">ADMINS</code> or <code class=\"docutils literal notranslate\">MANAGERS</code> settings to a list of\n(name, address) tuples will be removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">orphans</code> argument being larger than or equal to the <code class=\"docutils literal notranslate\">per_page</code>\nargument of <code class=\"docutils literal notranslate\">django.core.paginator.Paginator</code> and\n<code class=\"docutils literal notranslate\">django.core.paginator.AsyncPaginator</code> will no longer be allowed.</p></li>\n<li><p>The <a class=\"reference internal\" href=\"/zh-hans/6.0/topics/email/#module-django.core.mail\" title=\"django.core.mail: Helpers to easily send email.\"><code class=\"xref py py-mod docutils literal notranslate\">django.core.mail</code></a> APIs will no longer accept certain parameters as\npositional arguments. These must be passed as keyword arguments instead.</p></li>\n<li><p>Support for passing Python's legacy email <code class=\"docutils literal notranslate\">email.mime.base.MIMEBase</code>\nobject to <code class=\"docutils literal notranslate\">EmailMessage.attach()</code> (or including one in the message's\n<code class=\"docutils literal notranslate\">attachments</code> list) will be removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">django.core.mail.BadHeaderError</code> exception will be removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">django.core.mail.SafeMIMEText</code> and <code class=\"docutils literal notranslate\">SafeMIMEMultipart</code> classes will\nbe removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">django.core.mail.forbid_multi_line_headers()</code> and\n<code class=\"docutils literal notranslate\">django.core.mail.message.sanitize_address()</code> functions will be removed.</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-6-1\">\n<span id=\"id2\"></span><h2>6.1<a class=\"heading-anchor\" href=\"#deprecation-removed-in-6-1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>See the <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/5.2/#deprecated-features-5-2\"><span class=\"std std-ref\">Django 5.2 release notes</span></a> for more\ndetails on these changes.</p>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\">all</code> keyword argument of <code class=\"docutils literal notranslate\">django.contrib.staticfiles.finders.find()</code>\nwill be removed.</p></li>\n<li><p>Fallbacks to <code class=\"docutils literal notranslate\">request.user</code> and <code class=\"docutils literal notranslate\">request.auser()</code> when <code class=\"docutils literal notranslate\">user</code> is\n<code class=\"docutils literal notranslate\">None</code> in <code class=\"docutils literal notranslate\">django.contrib.auth.login()</code> and\n<code class=\"docutils literal notranslate\">django.contrib.auth.alogin()</code>, respectively, will be removed.</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">ordering</code> keyword argument of the PostgreSQL specific aggregation\nfunctions <code class=\"docutils literal notranslate\">django.contrib.postgres.aggregates.ArrayAgg</code>,\n<code class=\"docutils literal notranslate\">django.contrib.postgres.aggregates.JSONBAgg</code>, and\n<code class=\"docutils literal notranslate\">django.contrib.postgres.aggregates.StringAgg</code> will be removed.</p></li>\n<li><p>Support for subclasses of <code class=\"docutils literal notranslate\">RemoteUserMiddleware</code> that override\n<code class=\"docutils literal notranslate\">process_request()</code> without overriding <code class=\"docutils literal notranslate\">aprocess_request()</code> will be\nremoved.</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-6-0\">\n<span id=\"id3\"></span><h2>6.0<a class=\"heading-anchor\" href=\"#deprecation-removed-in-6-0\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/5.0/#deprecated-features-5-0\"><span class=\"std std-ref\">Django 5.0 发布说明</span></a> 以获取更多关于这些更改的详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">DjangoDivFormRenderer</code> 和 <code class=\"docutils literal notranslate\">Jinja2DivFormRenderer</code> 过渡性表单渲染器将被移除。</p></li>\n<li><p>将移除对于将位置参数传递给 <code class=\"docutils literal notranslate\">BaseConstraint</code> 的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">request</code> 将在 <code class=\"docutils literal notranslate\">ModelAdmin.lookup_allowed()</code> 的子类的签名中变成必需。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.sql.datastructures.Join</code> 不再回退到 <code class=\"docutils literal notranslate\">get_joining_columns()</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">ForeignObject</code> 和 <code class=\"docutils literal notranslate\">ForeignObjectRel</code> 的 <code class=\"docutils literal notranslate\">get_joining_columns()</code> 方法将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">ForeignObject.get_reverse_joining_columns()</code> 方法将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">forms.URLField</code> 的默认方案将从 <code class=\"docutils literal notranslate\">&quot;http&quot;</code> 更改为 <code class=\"docutils literal notranslate\">&quot;https&quot;</code>。</p></li>\n<li><p>不再支持在不传递 args 或 kwargs 的情况下调用 <code class=\"docutils literal notranslate\">format_html()</code>。</p></li>\n<li><p>不再支持 <code class=\"docutils literal notranslate\">cx_Oracle</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">BaseDatabaseOperations.field_cast_sql()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">ChoicesMeta</code> 到 <code class=\"docutils literal notranslate\">django.db.models.enums.ChoicesType</code> 的别名将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">Prefetch.get_current_queryset()</code> 方法将被移除。</p></li>\n<li><p>相关管理器和描述符的 <code class=\"docutils literal notranslate\">get_prefetch_queryset()</code> 方法将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">get_prefetcher()</code> 和 <code class=\"docutils literal notranslate\">prefetch_related_objects()</code> 将不再回退到 <code class=\"docutils literal notranslate\">get_prefetch_queryset()</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">FORMS_URLFIELD_ASSUME_HTTPS</code> 过渡性设置将被移除。</p></li>\n</ul>\n<p>有关这些更改的更多详细信息，请参阅 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/5.1/#deprecated-features-5-1\"><span class=\"std std-ref\">Django 5.1 发布说明</span></a>。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">ModelAdmin.log_deletion()</code> 和 <code class=\"docutils literal notranslate\">LogEntryManager.log_action()</code> 方法将被移除。</p></li>\n<li><p>未记录的 <code class=\"docutils literal notranslate\">django.utils.itercompat.is_iterable()</code> 函数和 <code class=\"docutils literal notranslate\">django.utils.itercompat</code> 模块将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.geoip2.GeoIP2.coords()</code> 方法将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.geoip2.GeoIP2.open()</code> 方法将被移除。</p></li>\n<li><p>支持向 <code class=\"docutils literal notranslate\">Model.save()</code> 和 <code class=\"docutils literal notranslate\">Model.asave()</code> 传递位置参数的功能将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.gdal.OGRGeometry.coord_dim</code> 的设置器将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.urls.register_converter()</code> 将不再允许覆盖现有的转换器。</p></li>\n<li><p><code class=\"docutils literal notranslate\">CheckConstraint</code> 的 <code class=\"docutils literal notranslate\">check</code> 关键字参数将被移除。</p></li>\n<li><p><a class=\"reference internal\" href=\"/zh-hans/6.0/ref/files/storage/#django.core.files.storage.FileSystemStorage\" title=\"django.core.files.storage.FileSystemStorage\"><code class=\"xref py py-class docutils literal notranslate\">FileSystemStorage</code></a> 的 <code class=\"docutils literal notranslate\">OS_OPEN_FLAGS</code> 属性将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">FieldCacheMixin</code> 的 <code class=\"docutils literal notranslate\">get_cache_name()</code> 方法将被移除。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-5-1\">\n<span id=\"id4\"></span><h2>5.1<a class=\"heading-anchor\" href=\"#deprecation-removed-in-5-1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>有关这些更改的更多详细信息，请参阅 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/4.2/#deprecated-features-4-2\"><span class=\"std std-ref\">Django 4.2 发布说明</span></a>。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">BaseUserManager.make_random_password()</code> 方法将被移除。</p></li>\n<li><p>模型的 <code class=\"docutils literal notranslate\">Meta.index_together</code> 选项将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">length_is</code> 模板过滤器将被移除。</p></li>\n<li><p>将移除 <code class=\"docutils literal notranslate\">django.contrib.auth.hashers.SHA1PasswordHasher</code>、<code class=\"docutils literal notranslate\">django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher</code> 和 <code class=\"docutils literal notranslate\">django.contrib.auth.hashers.UnsaltedMD5PasswordHasher</code>。</p></li>\n<li><p>模型 <code class=\"docutils literal notranslate\">django.contrib.postgres.fields.CICharField</code>、<code class=\"docutils literal notranslate\">django.contrib.postgres.fields.CIEmailField</code> 和 <code class=\"docutils literal notranslate\">django.contrib.postgres.fields.CITextField</code> 将被移除。为了与历史迁移兼容，将保留存根字段。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.postgres.fields.CIText</code> mixin 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">BaseGeometryWidget</code> 的 <code class=\"docutils literal notranslate\">map_width</code> 和 <code class=\"docutils literal notranslate\">map_height</code> 属性将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">SimpleTestCase.assertFormsetError()</code> 方法将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">TransactionTestCase.assertQuerysetEqual()</code> 方法将被移除。</p></li>\n<li><p>将移除将编码的 JSON 字符串字面量传递给 <code class=\"docutils literal notranslate\">JSONField</code> 以及相关查找和表达式的支持。</p></li>\n<li><p>将移除向 <code class=\"docutils literal notranslate\">Signer</code> 和 <code class=\"docutils literal notranslate\">TimestampSigner</code> 传递位置参数的支持。</p></li>\n<li><p>将移除 <code class=\"docutils literal notranslate\">DEFAULT_FILE_STORAGE</code> 和 <code class=\"docutils literal notranslate\">STATICFILES_STORAGE</code> 设置。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.files.storage.get_storage_class()</code> 函数将被移除。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-5-0\">\n<span id=\"id5\"></span><h2>5.0<a class=\"heading-anchor\" href=\"#deprecation-removed-in-5-0\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>有关这些更改的更多详细信息，请参阅 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/4.0/#deprecated-features-4-0\"><span class=\"std std-ref\">Django 4.0 发布说明</span></a>。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">SERIALIZE</code> 测试设置将被移除。</p></li>\n<li><p>未记录的 <code class=\"docutils literal notranslate\">django.utils.baseconv</code> 模块将被移除。</p></li>\n<li><p>未记录的 <code class=\"docutils literal notranslate\">django.utils.datetime_safe</code> 模块将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">USE_TZ</code> 设置的默认值将从 <code class=\"docutils literal notranslate\">False</code> 更改为 <code class=\"docutils literal notranslate\">True</code>。</p></li>\n<li><p>在请求上下文之外构建的站点地图的默认站点地图协议将从 <code class=\"docutils literal notranslate\">'http'</code> 更改为 <code class=\"docutils literal notranslate\">'https'</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">DiscoverRunner.build_suite()</code> 和 <code class=\"docutils literal notranslate\">DiscoverRunner.run_tests()</code> 的 <code class=\"docutils literal notranslate\">extra_tests</code> 参数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.postgres.aggregates.ArrayAgg</code>、<code class=\"docutils literal notranslate\">JSONBAgg</code> 和 <code class=\"docutils literal notranslate\">StringAgg</code> 聚合在没有行时将返回 <code class=\"docutils literal notranslate\">None</code>，而不再返回 <code class=\"docutils literal notranslate\">[]</code>、<code class=\"docutils literal notranslate\">[]</code> 和 <code class=\"docutils literal notranslate\">''</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">USE_L10N</code> 设置将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">USE_DEPRECATED_PYTZ</code> 过渡设置将被移除。</p></li>\n<li><p>将移除对 <code class=\"docutils literal notranslate\">pytz</code> 时区的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">is_dst</code> 参数将从以下方法中移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">QuerySet.datetimes()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.timezone.make_aware()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.functions.Trunc()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.functions.TruncSecond()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.functions.TruncMinute()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.functions.TruncHour()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.functions.TruncDay()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.functions.TruncWeek()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.functions.TruncMonth()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.functions.TruncQuarter()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.functions.TruncYear()</code></p></li>\n</ul>\n</li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.admin.GeoModelAdmin</code> 和 <code class=\"docutils literal notranslate\">OSMGeoAdmin</code> 类将被移除。</p></li>\n<li><p>未记录的 <code class=\"docutils literal notranslate\">BaseForm._html_output()</code> 方法将被移除。</p></li>\n<li><p>在渲染 <code class=\"docutils literal notranslate\">ErrorDict</code> 和 <code class=\"docutils literal notranslate\">ErrorList</code> 时返回 <code class=\"docutils literal notranslate\">str</code> 而不是 <code class=\"docutils literal notranslate\">SafeString</code> 的能力将被移除。</p></li>\n</ul>\n<p>有关这些更改的更多详细信息，请参阅 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/4.1/#deprecated-features-4-1\"><span class=\"std std-ref\">Django 4.1 发布说明</span></a>。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">SitemapIndexItem.__str__()</code> 方法将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">CSRF_COOKIE_MASKED</code> 过渡设置将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.functional.cached_property()</code> 的 <code class=\"docutils literal notranslate\">name</code> 参数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.postgres.constraints.ExclusionConstraint</code> 的 <code class=\"docutils literal notranslate\">opclasses</code> 参数将被移除。</p></li>\n<li><p>未记录的能力传递 <code class=\"docutils literal notranslate\">errors=None</code> 到 <code class=\"docutils literal notranslate\">SimpleTestCase.assertFormError()</code> 和 <code class=\"docutils literal notranslate\">assertFormsetError()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.sessions.serializers.PickleSerializer</code> 将被移除。</p></li>\n<li><p>不再允许在预取相关对象的查询集上使用未提供 <code class=\"docutils literal notranslate\">chunk_size</code> 参数的 <code class=\"docutils literal notranslate\">QuerySet.iterator()</code> 的用法。</p></li>\n<li><p>不再允许将未保存的模型实例传递给相关过滤器。</p></li>\n<li><p>在 <code class=\"docutils literal notranslate\">RemoteUserBackend.configure_user()</code> 子类的签名中将需要 <code class=\"docutils literal notranslate\">created=True</code>。</p></li>\n<li><p>将移除通过 <code class=\"docutils literal notranslate\">GET</code> 请求在 <code class=\"docutils literal notranslate\">django.contrib.auth.views.LogoutView</code> 和 <code class=\"docutils literal notranslate\">django.contrib.auth.views.logout_then_login()</code> 中注销的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.timezone.utc</code> 到 <code class=\"docutils literal notranslate\">datetime.timezone.utc</code> 的别名将被移除。</p></li>\n<li><p>不再允许将响应对象和表单/表单集名称传递给 <code class=\"docutils literal notranslate\">SimpleTestCase.assertFormError()</code> 和 <code class=\"docutils literal notranslate\">assertFormsetError()</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.admin.OpenLayersWidget</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.auth.hashers.CryptPasswordHasher</code> 将被移除。</p></li>\n<li><p>将移除模板 <code class=\"docutils literal notranslate\">&quot;django/forms/default.html&quot;</code> 和 <code class=\"docutils literal notranslate\">&quot;django/forms/formsets/default.html&quot;</code>。</p></li>\n<li><p>将移除在 <code class=\"docutils literal notranslate\">Expression.asc()</code> 和 <code class=\"docutils literal notranslate\">Expression.desc()</code> 方法以及 <code class=\"docutils literal notranslate\">OrderBy</code> 表达式中传递 <code class=\"docutils literal notranslate\">nulls_first=False</code> 或 <code class=\"docutils literal notranslate\">nulls_last=False</code> 的能力。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-4-1\">\n<span id=\"id6\"></span><h2>4.1<a class=\"heading-anchor\" href=\"#deprecation-removed-in-4-1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/3.2/#deprecated-features-3-2\"><span class=\"std std-ref\">Django 3.2 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p>将移除在 <code class=\"docutils literal notranslate\">TestCase.setUpTestData()</code> 中将不支持使用 <code class=\"docutils literal notranslate\">copy.deepcopy()</code> 创建深拷贝的对象分配给类属性的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">BaseCommand.requires_system_checks</code> 将不再支持布尔值。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.validators.EmailValidator</code> 的 <code class=\"docutils literal notranslate\">whitelist</code> 参数和 <code class=\"docutils literal notranslate\">domain_whitelist</code> 属性将被移除。</p></li>\n<li><p>将移除 <code class=\"docutils literal notranslate\">default_app_config</code> 模块变量。</p></li>\n<li><p><code class=\"docutils literal notranslate\">TransactionTestCase.assertQuerysetEqual()</code> 不再在与字符串值比较时自动调用 <code class=\"docutils literal notranslate\">repr()</code> 来处理查询集。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.cache.backends.memcached.MemcachedCache</code> 将被移除。</p></li>\n<li><p>将移除对 <code class=\"docutils literal notranslate\">django.contrib.messages.storage.cookie.CookieStorage</code> 使用的 Django 3.2 之前的消息格式的支持。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-4-0\">\n<span id=\"id7\"></span><h2>4.0<a class=\"heading-anchor\" href=\"#deprecation-removed-in-4-0\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/3.0/#deprecated-features-3-0\"><span class=\"std std-ref\">Django 3.0 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.utils.http.urlquote()</code>, <code class=\"docutils literal notranslate\">urlquote_plus()</code>, <code class=\"docutils literal notranslate\">urlunquote()</code>, 和 <code class=\"docutils literal notranslate\">urlunquote_plus()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.encoding.force_text()</code> 和 <code class=\"docutils literal notranslate\">smart_text()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.translation.ugettext()</code>, <code class=\"docutils literal notranslate\">ugettext_lazy()</code>, <code class=\"docutils literal notranslate\">ugettext_noop()</code>, <code class=\"docutils literal notranslate\">ungettext()</code>, 和 <code class=\"docutils literal notranslate\">ungettext_lazy()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.views.i18n.set_language()</code> 将不再在 <code class=\"docutils literal notranslate\">request.session</code> 中设置用户语言（键为 <code class=\"docutils literal notranslate\">django.utils.translation.LANGUAGE_SESSION_KEY</code>）。</p></li>\n<li><p>在 <code class=\"docutils literal notranslate\">django.db.models.Expression.get_group_by_cols()</code> 子类的签名中将需要 <code class=\"docutils literal notranslate\">alias=None</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.text.unescape_entities()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.http.is_safe_url()</code> 将被移除。</p></li>\n</ul>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/3.1/#deprecated-features-3-1\"><span class=\"std std-ref\">Django 3.1 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">PASSWORD_RESET_TIMEOUT_DAYS</code> 设置将被移除。</p></li>\n<li><p>不再允许在非布尔值作为右操作数的情况下使用未记录的 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/models/querysets/#std-fieldlookup-isnull\"><code class=\"xref std std-lookup docutils literal notranslate\">isnull</code></a> 查询。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.query_utils.InvalidQuery</code> 异常类将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django-admin.py</code> 入口点将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">HttpRequest.is_ajax()</code> 方法将被移除。</p></li>\n<li><p>将移除 <code class=\"docutils literal notranslate\">django.contrib.messages.storage.cookie.CookieStorage</code> 使用的 Django 3.1 之前的 Cookie 值的编码格式的支持。</p></li>\n<li><p>将移除在管理员网站中（使用 SHA-1 哈希算法的） Django 3.1 之前的密码重置令牌的支持。</p></li>\n<li><p>将移除 Django 3.1 之前的会话编码格式的支持。</p></li>\n<li><p>将移除在 Django 3.1 之前（使用 SHA-1 算法编码的） <code class=\"docutils literal notranslate\">django.core.signing.Signer</code> 签名的支持。</p></li>\n<li><p>将移除在 Django 3.1 之前使用 SHA-1 算法编码的 <code class=\"docutils literal notranslate\">django.core.signing.dumps()</code> 签名在 <code class=\"docutils literal notranslate\">django.core.signing.loads()</code> 中的支持。</p></li>\n<li><p>将移除在 Django 3.1 之前（使用 SHA-1 算法的）用户会话的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.deprecation.MiddlewareMixin.__init__()</code> 的 <code class=\"docutils literal notranslate\">get_response</code> 参数将需要，并且不会接受 <code class=\"docutils literal notranslate\">None</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.dispatch.Signal</code> 的 <code class=\"docutils literal notranslate\">providing_args</code> 参数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.crypto.get_random_string()</code> 的 <code class=\"docutils literal notranslate\">length</code> 参数将变为必填项。</p></li>\n<li><p><code class=\"docutils literal notranslate\">ModelMultipleChoiceField</code> 中的 <code class=\"docutils literal notranslate\">list</code> 消息将被移除。</p></li>\n<li><p>将移除将原始列别名传递给 <code class=\"docutils literal notranslate\">QuerySet.order_by()</code> 的支持。</p></li>\n<li><p>模型 <code class=\"docutils literal notranslate\">NullBooleanField</code> 将被移除，为了与历史迁移兼容，将保留一个存根字段。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.conf.urls.url()</code> 将被移除。</p></li>\n<li><p>模型 <code class=\"docutils literal notranslate\">django.contrib.postgres.fields.JSONField</code> 将被移除，为了与历史迁移兼容，将保留一个存根字段。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.postgres.forms.JSONField</code>、<code class=\"docutils literal notranslate\">django.contrib.postgres.fields.jsonb.KeyTransform</code> 和 <code class=\"docutils literal notranslate\">django.contrib.postgres.fields.jsonb.KeyTextTransform</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">{% ifequal %}</code> 和 <code class=\"docutils literal notranslate\">{% ifnotequal %}</code> 模板标签将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">DEFAULT_HASHING_ALGORITHM</code> 过渡设置将被移除。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-3-1\">\n<span id=\"id8\"></span><h2>3.1<a class=\"heading-anchor\" href=\"#deprecation-removed-in-3-1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/2.2/#deprecated-features-2-2\"><span class=\"std std-ref\">Django 2.2 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.utils.timezone.FixedOffset</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.paginator.QuerySetPaginator</code> 将被移除。</p></li>\n<li><p>模型的 <code class=\"docutils literal notranslate\">Meta.ordering</code> 将不再影响 <code class=\"docutils literal notranslate\">GROUP BY</code> 查询。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.postgres.fields.FloatRangeField</code> 和 <code class=\"docutils literal notranslate\">django.contrib.postgres.forms.FloatRangeField</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">FILE_CHARSET</code> 设置将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.staticfiles.storage.CachedStaticFilesStorage</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">RemoteUserBackend.configure_user()</code> 将要求将 <code class=\"docutils literal notranslate\">request</code> 作为第一个位置参数传递。</p></li>\n<li><p>将移除对 <code class=\"docutils literal notranslate\">SimpleTestCase.allow_database_queries</code> 和 <code class=\"docutils literal notranslate\">TransactionTestCase.multi_db</code> 的支持。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-3-0\">\n<span id=\"id9\"></span><h2>3.0<a class=\"heading-anchor\" href=\"#deprecation-removed-in-3-0\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/2.0/#deprecated-features-2-0\"><span class=\"std std-ref\">Django 2.0 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.db.backends.postgresql_psycopg2</code> 模块将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render_to_response()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">DEFAULT_CONTENT_TYPE</code> 设置将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">HttpRequest.xreadlines()</code> 将被移除。</p></li>\n<li><p>将移除对 <code class=\"docutils literal notranslate\">Field.from_db_value()</code> 和 <code class=\"docutils literal notranslate\">Expression.convert_value()</code> 的 <code class=\"docutils literal notranslate\">context</code> 参数的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">QuerySet.earliest()</code> 和 <code class=\"docutils literal notranslate\">latest()</code> 的 <code class=\"docutils literal notranslate\">field_name</code> 关键字参数将被移除。</p></li>\n</ul>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/2.1/#deprecated-features-2-1\"><span class=\"std std-ref\">Django 2.1 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.db.models.functions.ForceRHR</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.http.cookie_date()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">staticfiles</code> 和 <code class=\"docutils literal notranslate\">admin_static</code> 模板标签库将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.staticfiles.templatetags.static()</code> 将被移除。</p></li>\n<li><p>将移除允许定义 <code class=\"docutils literal notranslate\">InlineModelAdmin.has_add_permission()</code> 时没有 <code class=\"docutils literal notranslate\">obj</code> 参数的兼容性层。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-2-1\">\n<span id=\"id10\"></span><h2>2.1<a class=\"heading-anchor\" href=\"#deprecation-removed-in-2-1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.11/#deprecated-features-1-11\"><span class=\"std std-ref\">Django 1.11 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">contrib.auth.views.login()</code>, <code class=\"docutils literal notranslate\">logout()</code>, <code class=\"docutils literal notranslate\">password_change()</code>, <code class=\"docutils literal notranslate\">password_change_done()</code>, <code class=\"docutils literal notranslate\">password_reset()</code>, <code class=\"docutils literal notranslate\">password_reset_done()</code>, <code class=\"docutils literal notranslate\">password_reset_confirm()</code>, 和 <code class=\"docutils literal notranslate\">password_reset_complete()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">contrib.auth.views.logout_then_login()</code> 的 <code class=\"docutils literal notranslate\">extra_context</code> 参数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.test.runner.setup_databases()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.translation.string_concat()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.cache.backends.memcached.PyLibMCCache</code> 将不再支持将 <code class=\"docutils literal notranslate\">pylibmc</code> 行为设置作为 <code class=\"docutils literal notranslate\">OPTIONS</code> 的顶级属性传递。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.http.is_safe_url()</code> 的 <code class=\"docutils literal notranslate\">host</code> 参数将被移除。</p></li>\n<li><p>将移除在渲染 <code class=\"docutils literal notranslate\">{% include %}</code> 模板标签时抑制异常的功能。</p></li>\n<li><p><code class=\"docutils literal notranslate\">DatabaseIntrospection.get_indexes()</code> 将被移除。</p></li>\n<li><p>认证后端的 <code class=\"docutils literal notranslate\">authenticate()</code> 方法将要求将 <code class=\"docutils literal notranslate\">request</code> 作为第一个位置参数传递。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.permalink()</code> 装饰器将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">USE_ETAGS</code> 设置将被移除。<code class=\"docutils literal notranslate\">CommonMiddleware</code> 和 <code class=\"docutils literal notranslate\">django.utils.cache.patch_response_headers()</code> 将不再设置 ETags。</p></li>\n<li><p><code class=\"docutils literal notranslate\">Model._meta.has_auto_field</code> 属性将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">url()</code> 对正则表达式组中的内联标志（<code class=\"docutils literal notranslate\">(?i)</code>, <code class=\"docutils literal notranslate\">(?L)</code>, <code class=\"docutils literal notranslate\">(?m)</code>, <code class=\"docutils literal notranslate\">(?s)</code>, 和 <code class=\"docutils literal notranslate\">(?u)</code>）的支持将被移除。</p></li>\n<li><p>将移除没有 <code class=\"docutils literal notranslate\">renderer</code> 参数的 <code class=\"docutils literal notranslate\">Widget.render()</code> 方法的支持。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-2-0\">\n<span id=\"id11\"></span><h2>2.0<a class=\"heading-anchor\" href=\"#deprecation-removed-in-2-0\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.9/#deprecated-features-1-9\"><span class=\"std std-ref\">Django 1.9 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.dispatch.signals.Signal.disconnect()</code> 中的 <code class=\"docutils literal notranslate\">weak</code> 参数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.backends.base.BaseDatabaseOperations.check_aggregate_support()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.forms.extras</code> 包将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">assignment_tag</code> 助手将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">assertsRedirects</code> 中的 <code class=\"docutils literal notranslate\">host</code> 参数将被移除。还将移除兼容性层，允许在路径相同的情况下将绝对 URL 视为与相对 URL 相等。</p></li>\n<li><p><code class=\"docutils literal notranslate\">Field.rel</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">Field.remote_field.to</code> 属性将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">ForeignKey</code> 和 <code class=\"docutils literal notranslate\">OneToOneField</code> 的 <code class=\"docutils literal notranslate\">on_delete</code> 参数将变为必填项。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.fields.add_lazy_relation()</code> 将被移除。</p></li>\n<li><p>在启用时区支持时，不再将不支持时区的数据库后端将具有意识到时区的日期时间转换为 UTC 中的不明确值，当这些值作为参数传递给 ORM 之外执行的 SQL 查询，例如，使用 <code class=\"docutils literal notranslate\">cursor.execute()</code> 时。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.auth.tests.utils.skipIfCustomUser()</code> 装饰器将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">GeoManager</code> 和 <code class=\"docutils literal notranslate\">GeoQuerySet</code> 类将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.geoip</code> 模块将被移除。</p></li>\n<li><p>模板加载器中的 <code class=\"docutils literal notranslate\">supports_recursion</code> 检查将从以下内容中移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.template.engine.Engine.find_template()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loader_tags.ExtendsNode.find_template()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loaders.base.Loader.supports_recursion()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loaders.cached.Loader.supports_recursion()</code></p></li>\n</ul>\n</li>\n<li><p><code class=\"docutils literal notranslate\">load_template()</code> 和 <code class=\"docutils literal notranslate\">load_template_sources()</code> 模板加载器方法将被移除。</p></li>\n<li><p>模板加载器的 <code class=\"docutils literal notranslate\">template_dirs</code> 参数将被移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.template.loaders.base.Loader.get_template()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loaders.cached.Loader.cache_key()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loaders.cached.Loader.get_template()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loaders.cached.Loader.get_template_sources()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loaders.filesystem.Loader.get_template_sources()</code></p></li>\n</ul>\n</li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loaders.base.Loader.__call__()</code> 方法将被移除。</p></li>\n<li><p>将不再支持具有单个位置参数的自定义错误视图。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.feedgenerator.Atom1Feed</code> 和 <code class=\"docutils literal notranslate\">django.utils.feedgenerator.RssFeed</code> 的 <code class=\"docutils literal notranslate\">mime_type</code> 属性将被移除，而 <code class=\"docutils literal notranslate\">content_type</code> 将取而代之。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.conf.urls.include()</code> 的 <code class=\"docutils literal notranslate\">app_name</code> 参数将被移除。</p></li>\n<li><p>将移除将 3 元组作为 <code class=\"docutils literal notranslate\">include()</code> 的第一个参数传递的支持。</p></li>\n<li><p>将移除在不设置应用程序命名空间的情况下设置 URL 实例命名空间的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">Field._get_val_from_obj()</code> 将被移除，取而代之的是 <code class=\"docutils literal notranslate\">Field.value_from_object()</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loaders.eggs.Loader</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">contrib.auth</code> 视图的 <code class=\"docutils literal notranslate\">current_app</code> 参数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">SimpleTestCase.assertRaisesMessage()</code> 函数的 <code class=\"docutils literal notranslate\">callable_obj</code> 关键字参数将被移除。</p></li>\n<li><p>在 <code class=\"docutils literal notranslate\">ModelAdmin</code> 方法上的 <code class=\"docutils literal notranslate\">allow_tags</code> 属性的支持将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">SyndicationFeed.add_item()</code> 函数的 <code class=\"docutils literal notranslate\">enclosure</code> 关键字参数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loader.LoaderOrigin</code> 和 <code class=\"docutils literal notranslate\">django.template.base.StringOrigin</code> 对于 <code class=\"docutils literal notranslate\">django.template.base.Origin</code> 的别名将被移除。</p></li>\n</ul>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.10/#deprecated-features-1-10\"><span class=\"std std-ref\">Django 1.10 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">makemigrations --exit</code> 选项将被移除。</p></li>\n<li><p>将移除直接对反向外键或多对多关系进行赋值的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.geos.GEOSGeometry</code> 的 <code class=\"docutils literal notranslate\">get_srid()</code> 和 <code class=\"docutils literal notranslate\">set_srid()</code> 方法将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.geos.Point</code> 的 <code class=\"docutils literal notranslate\">get_x()</code>、<code class=\"docutils literal notranslate\">set_x()</code>、<code class=\"docutils literal notranslate\">get_y()</code>、<code class=\"docutils literal notranslate\">set_y()</code>、<code class=\"docutils literal notranslate\">get_z()</code> 和 <code class=\"docutils literal notranslate\">set_z()</code> 方法将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.geos.Point</code> 的 <code class=\"docutils literal notranslate\">get_coords()</code> 和 <code class=\"docutils literal notranslate\">set_coords()</code> 方法将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.geos.MultiPolygon</code> 的 <code class=\"docutils literal notranslate\">cascaded_union</code> 属性将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.functional.allow_lazy()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">shell --plain</code> 选项将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.urlresolvers</code> 模块将被移除。</p></li>\n<li><p>模型 <code class=\"docutils literal notranslate\">CommaSeparatedIntegerField</code> 将被移除。为了与历史迁移兼容性，将保留一个存根字段。</p></li>\n<li><p>模板中 <code class=\"docutils literal notranslate\">Context.has_key()</code> 方法的支持将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.files.storage.Storage</code> 的 <code class=\"docutils literal notranslate\">accessed_time()</code>、<code class=\"docutils literal notranslate\">created_time()</code> 和 <code class=\"docutils literal notranslate\">modified_time()</code> 方法的支持将被移除。</p></li>\n<li><p>当设置了 <code class=\"docutils literal notranslate\">Meta.default_related_name</code> 时，将移除使用模型名称进行查询查找的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">__search</code> 查询查找以及 <code class=\"docutils literal notranslate\">DatabaseOperations.fulltext_search_sql()</code> 方法将被移除。</p></li>\n<li><p>将移除支持自定义相关管理器类但没有 <code class=\"docutils literal notranslate\">_apply_rel_filters()</code> 方法的 shim。</p></li>\n<li><p>将不再支持使用 <code class=\"docutils literal notranslate\">User.is_authenticated()</code> 和 <code class=\"docutils literal notranslate\">User.is_anonymous()</code> 作为方法。</p></li>\n<li><p>将移除 <code class=\"docutils literal notranslate\">Model._meta</code> 的私有属性 <code class=\"docutils literal notranslate\">virtual_fields</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">Field.contribute_to_class()</code> 中的私有关键字参数 <code class=\"docutils literal notranslate\">virtual_only</code> 和 <code class=\"docutils literal notranslate\">Model._meta.add_field()</code> 中的 <code class=\"docutils literal notranslate\">virtual</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">javascript_catalog()</code> 和 <code class=\"docutils literal notranslate\">json_catalog()</code> 视图将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.utils.precision_wkt()</code> 函数将被移除。</p></li>\n<li><p>在多表继承中，隐式将 <code class=\"docutils literal notranslate\">OneToOneField</code> 提升为 <code class=\"docutils literal notranslate\">parent_link</code> 的操作将被移除。</p></li>\n<li><p>将移除对 <code class=\"docutils literal notranslate\">Widget._format_value()</code> 的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">FileField</code> 的方法 <code class=\"docutils literal notranslate\">get_directory_name()</code> 和 <code class=\"docutils literal notranslate\">get_filename()</code> 将被移除。</p></li>\n<li><p>将移除 <code class=\"docutils literal notranslate\">mark_for_escaping()</code> 函数及其使用的类：<code class=\"docutils literal notranslate\">EscapeData</code>、<code class=\"docutils literal notranslate\">EscapeBytes</code>、<code class=\"docutils literal notranslate\">EscapeText</code>、<code class=\"docutils literal notranslate\">EscapeString</code> 和 <code class=\"docutils literal notranslate\">EscapeUnicode</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">escape</code> 过滤器将更改为使用 <code class=\"docutils literal notranslate\">django.utils.html.conditional_escape()</code>。</p></li>\n<li><p>将移除 <code class=\"docutils literal notranslate\">Manager.use_for_related_fields</code>。</p></li>\n<li><p>模型的 <code class=\"docutils literal notranslate\">Manager</code> 继承将遵循 MRO 继承规则，并且用于选择此行为的 <code class=\"docutils literal notranslate\">Meta.manager_inheritance_from_future</code> 将被移除。</p></li>\n<li><p>将移除对使用 <code class=\"docutils literal notranslate\">settings.MIDDLEWARE_CLASSES</code> 的旧式中间件的支持。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-1-10\">\n<span id=\"id12\"></span><h2>1.10<a class=\"heading-anchor\" href=\"#deprecation-removed-in-1-10\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.8/#deprecated-features-1-8\"><span class=\"std std-ref\">Django 1.8 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p>将移除直接调用 <code class=\"docutils literal notranslate\">SQLCompiler</code> 作为调用其 <code class=\"docutils literal notranslate\">quote_name_unless_alias</code> 方法的别名的支持。</p></li>\n<li><p><code class=\"docutils literal notranslate\">cycle</code> 和 <code class=\"docutils literal notranslate\">firstof</code> 模板标签将从 <code class=\"docutils literal notranslate\">future</code> 模板标签库中移除（在 1.6/1.7 弃用期间使用）。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.conf.urls.patterns()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.conf.urls.i18n.i18n_patterns()</code> 中的 <code class=\"docutils literal notranslate\">prefix</code> 参数支持将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">SimpleTestCase.urls</code> 将被移除。</p></li>\n<li><p>在模板标签 <code class=\"docutils literal notranslate\">for</code> 中使用错误的解包值数量将引发异常，而不会默默失败。</p></li>\n<li><p>将移除使用点分隔的 Python 路径来反向生成 URL 的能力。</p></li>\n<li><p>将移除对 <code class=\"docutils literal notranslate\">LOGIN_URL</code> 和 <code class=\"docutils literal notranslate\">LOGIN_REDIRECT_URL</code> 设置使用点分隔的 Python 路径的能力。</p></li>\n<li><p>Support for <a class=\"reference external\" href=\"https://docs.python.org/3/library/optparse.html#module-optparse\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">optparse</code></a> will be dropped for custom management commands\n(replaced by <a class=\"reference external\" href=\"https://docs.python.org/3/library/argparse.html#module-argparse\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">argparse</code></a>).</p></li>\n<li><p>类 <code class=\"docutils literal notranslate\">django.core.management.NoArgsCommand</code> 将被移除。请改用默认不接受参数的 <a class=\"reference internal\" href=\"/zh-hans/6.0/howto/custom-management-commands/#django.core.management.BaseCommand\" title=\"django.core.management.BaseCommand\"><code class=\"xref py py-class docutils literal notranslate\">BaseCommand</code></a>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.context_processors</code> 模块将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.sql.aggregates</code> 模块将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.db.models.sql.aggregates</code> 模块将被移除。</p></li>\n<li><p>以下是将被移除的 <code class=\"docutils literal notranslate\">django.db.sql.query.Query</code> 的方法和属性：</p>\n<ul>\n<li><p>属性：<code class=\"docutils literal notranslate\">aggregates</code> 和 <code class=\"docutils literal notranslate\">aggregate_select</code> 将被移除。</p></li>\n<li><p>方法：<code class=\"docutils literal notranslate\">add_aggregate</code>、<code class=\"docutils literal notranslate\">set_aggregate_mask</code> 和 <code class=\"docutils literal notranslate\">append_aggregate_mask</code> 将被移除。</p></li>\n</ul>\n</li>\n<li><p><code class=\"docutils literal notranslate\">django.template.resolve_variable</code> 将被移除。</p></li>\n<li><p>以下是将从 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/models/meta/#django.db.models.options.Options\" title=\"django.db.models.options.Options\"><code class=\"xref py py-class docutils literal notranslate\">django.db.models.options.Options</code></a> (<code class=\"docutils literal notranslate\">Model._meta</code>) 中移除的私有 API：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">get_field_by_name()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_field_names()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_fields_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_concrete_fields_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_m2m_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_objects()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_objects_with_model()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_many_to_many_objects()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">get_all_related_m2m_objects_with_model()</code></p></li>\n</ul>\n</li>\n<li><p><code class=\"docutils literal notranslate\">django.forms.RegexField</code> 的 <code class=\"docutils literal notranslate\">error_message</code> 参数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">unordered_list</code> 过滤器将不再支持旧式列表。</p></li>\n<li><p>将移除对字符串类型的 <code class=\"docutils literal notranslate\">view</code> 参数在 <code class=\"docutils literal notranslate\">url()</code> 中的支持。</p></li>\n<li><p>将移除将 <code class=\"docutils literal notranslate\">django.forms.Form._has_changed()</code> 重命名为 <code class=\"docutils literal notranslate\">has_changed()</code> 的向后兼容 shim。</p></li>\n<li><p><code class=\"docutils literal notranslate\">removetags</code> 模板过滤器将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.html</code> 中的 <code class=\"docutils literal notranslate\">remove_tags()</code> 和 <code class=\"docutils literal notranslate\">strip_entities()</code> 函数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.auth.views.password_reset()</code> 中的 <code class=\"docutils literal notranslate\">is_admin_site</code> 参数将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.field.subclassing.SubfieldBase</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.checksums</code> 将被移除；其功能已包含在 <code class=\"docutils literal notranslate\">django-localflavor</code> 1.1+ 中。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.admin.helpers.InlineAdminForm</code> 上的 <code class=\"docutils literal notranslate\">original_content_type_id</code> 属性将被移除。</p></li>\n<li><p>将移除向后兼容的 shim，以允许 <code class=\"docutils literal notranslate\">FormMixin.get_form()</code> 定义时不提供 <code class=\"docutils literal notranslate\">form_class</code> 参数的默认值。</p></li>\n<li><p>以下设置将被移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">ALLOWED_INCLUDE_ROOTS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_CONTEXT_PROCESSORS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_DEBUG</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_DIRS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_LOADERS</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">TEMPLATE_STRING_IF_INVALID</code></p></li>\n</ul>\n</li>\n<li><p>向后兼容的别名 <code class=\"docutils literal notranslate\">django.template.loader.BaseLoader</code> 将被移除。</p></li>\n<li><p>Django template objects returned by\n<a class=\"reference internal\" href=\"/zh-hans/6.0/topics/templates/#django.template.loader.get_template\" title=\"django.template.loader.get_template\"><code class=\"xref py py-func docutils literal notranslate\">get_template()</code></a> and\n<a class=\"reference internal\" href=\"/zh-hans/6.0/topics/templates/#django.template.loader.select_template\" title=\"django.template.loader.select_template\"><code class=\"xref py py-func docutils literal notranslate\">select_template()</code></a> won't accept a\n<a class=\"reference internal\" href=\"/zh-hans/6.0/ref/templates/api/#django.template.Context\" title=\"django.template.Context\"><code class=\"xref py py-class docutils literal notranslate\">Context</code></a> in their\n<a class=\"reference internal\" href=\"/zh-hans/6.0/topics/templates/#django.template.backends.base.Template.render\" title=\"django.template.backends.base.Template.render\"><code class=\"xref py py-meth docutils literal notranslate\">render()</code></a> method anymore.</p></li>\n<li><p><a class=\"reference internal\" href=\"/zh-hans/6.0/ref/template-response/\"><span class=\"doc\">Template response APIs</span></a> 将强制使用 <a class=\"reference external\" href=\"https://docs.python.org/3/library/stdtypes.html#dict\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">dict</code></a> 和依赖于后端的模板对象，而不再使用 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/templates/api/#django.template.Context\" title=\"django.template.Context\"><code class=\"xref py py-class docutils literal notranslate\">Context</code></a> 和 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/templates/api/#django.template.Template\" title=\"django.template.Template\"><code class=\"xref py py-class docutils literal notranslate\">Template</code></a>。</p></li>\n<li><p>以下函数和类的 <code class=\"docutils literal notranslate\">current_app</code> 参数将被移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.Context()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.RequestContext()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.response.TemplateResponse()</code></p></li>\n</ul>\n</li>\n<li><p>以下函数的 <code class=\"docutils literal notranslate\">dictionary</code> 和 <code class=\"docutils literal notranslate\">context_instance</code> 参数将被移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render_to_response()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loader.render_to_string()</code></p></li>\n</ul>\n</li>\n<li><p>以下函数的 <code class=\"docutils literal notranslate\">dirs</code> 参数将被移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.template.loader.get_template()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.template.loader.select_template()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.shortcuts.render_to_response()</code></p></li>\n</ul>\n</li>\n<li><p>会启用会话验证，不管 <code class=\"docutils literal notranslate\">'django.contrib.auth.middleware.SessionAuthenticationMiddleware'</code> 是否在 <code class=\"docutils literal notranslate\">MIDDLEWARE_CLASSES</code> 中。</p></li>\n<li><p>私有属性 <code class=\"docutils literal notranslate\">django.db.models.Field.related</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">migrate</code> 管理命令的 <code class=\"docutils literal notranslate\">--list</code> 选项将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">ssi</code> 模板标签将被移除。</p></li>\n<li><p>模板标签中的 <code class=\"docutils literal notranslate\">if</code> 不再支持 <code class=\"docutils literal notranslate\">=</code> 比较运算符。</p></li>\n<li><p>将移除允许在没有 <code class=\"docutils literal notranslate\">max_length</code> 参数的情况下定义 <code class=\"docutils literal notranslate\">Storage.get_available_name()</code> 和 <code class=\"docutils literal notranslate\">Storage.save()</code> 的向后兼容 shim。</p></li>\n<li><p>将移除在 <code class=\"docutils literal notranslate\">ModelFormMixin.success_url</code> 中的传统 <code class=\"docutils literal notranslate\">%(&lt;foo&gt;)s</code> 语法支持。</p></li>\n<li><p>将移除 <code class=\"docutils literal notranslate\">GeoQuerySet</code> 的聚合方法 <code class=\"docutils literal notranslate\">collect()</code>, <code class=\"docutils literal notranslate\">extent()</code>, <code class=\"docutils literal notranslate\">extent3d()</code>, <code class=\"docutils literal notranslate\">make_line()</code>, 和 <code class=\"docutils literal notranslate\">unionagg()</code>。</p></li>\n<li><p>将移除在创建内容类型实例时指定 <code class=\"docutils literal notranslate\">ContentType.name</code> 的能力。</p></li>\n<li><p>将移除对旧版 <code class=\"docutils literal notranslate\">allow_migrate</code> 签名的支持。它已从 <code class=\"docutils literal notranslate\">allow_migrate(self, db, model)</code> 更改为 <code class=\"docutils literal notranslate\">allow_migrate(self, db, app_label, model_name=None, **hints)</code>。</p></li>\n<li><p>将移除使用逗号分隔参数的 <code class=\"docutils literal notranslate\">{% cycle %}</code> 语法的支持。</p></li>\n<li><p>当给定无效的分隔符时，<a class=\"reference internal\" href=\"/zh-hans/6.0/topics/signing/#django.core.signing.Signer\" title=\"django.core.signing.Signer\"><code class=\"xref py py-class docutils literal notranslate\">Signer</code></a> 发出的警告将变为异常。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-1-9\">\n<span id=\"id13\"></span><h2>1.9<a class=\"heading-anchor\" href=\"#deprecation-removed-in-1-9\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.7/#deprecated-features-1-7\"><span class=\"std std-ref\">Django 1.7 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.utils.dictconfig</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.importlib</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.tzinfo</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.unittest</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">syncdb</code> 命令将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.signals.pre_syncdb</code> 和 <code class=\"docutils literal notranslate\">django.db.models.signals.post_syncdb</code> 将被移除。</p></li>\n<li><p>在数据库路由器上的 <code class=\"docutils literal notranslate\">allow_syncdb</code> 将不再自动变成 <code class=\"docutils literal notranslate\">allow_migrate</code>。</p></li>\n<li><p>将移除对没有迁移的应用程序的自动同步。除非您向 <code class=\"docutils literal notranslate\">migrate</code> 传递 <code class=\"docutils literal notranslate\">--run-syncdb</code> 选项，否则所有应用程序将成为必须进行迁移。</p></li>\n<li><p>将移除没有迁移的应用程序的 SQL 管理命令，包括 <code class=\"docutils literal notranslate\">sql</code>、<code class=\"docutils literal notranslate\">sqlall</code>、<code class=\"docutils literal notranslate\">sqlclear</code>、<code class=\"docutils literal notranslate\">sqldropindexes</code> 和 <code class=\"docutils literal notranslate\">sqlindexes</code>。</p></li>\n<li><p>将移除对自动加载 <code class=\"docutils literal notranslate\">initial_data</code> 固定数据和初始 SQL 数据的支持。</p></li>\n<li><p>所有模型都需要在一个已安装的应用程序中定义，或者声明一个显式的 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/models/options/#django.db.models.Options.app_label\" title=\"django.db.models.Options.app_label\"><code class=\"xref py py-attr docutils literal notranslate\">app_label</code></a>。此外，在其应用程序加载之前将无法导入它们。特别是，在其应用程序的根包中将无法导入模型。</p></li>\n<li><p>模型和表单中的 <code class=\"docutils literal notranslate\">IPAddressField</code> 将被移除。为了与历史迁移兼容性，将保留一个存根字段。</p></li>\n<li><p>将不再支持 <code class=\"docutils literal notranslate\">AppCommand.handle_app()</code>。</p></li>\n<li><p>将不再能够从 <code class=\"docutils literal notranslate\">django.contrib.sites.models</code> 导入 <code class=\"docutils literal notranslate\">RequestSite</code> 和 <code class=\"docutils literal notranslate\">get_current_site()</code>。</p></li>\n<li><p>通过 <code class=\"docutils literal notranslate\">runfcgi</code> 管理命令的 FastCGI 支持将被移除。请使用 WSGI 部署您的项目。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.datastructures.SortedDict</code> 将被移除。请改用 Python 标准库中的 <a class=\"reference external\" href=\"https://docs.python.org/3/library/collections.html#collections.OrderedDict\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">collections.OrderedDict</code></a>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">ModelAdmin.declared_fieldsets</code> 将被移除。</p></li>\n<li><p>在 Django 代码库中，<code class=\"docutils literal notranslate\">util.py</code> 的实例已被重命名为 <code class=\"docutils literal notranslate\">utils.py</code>，以统一所有 util 和 utils 引用。提供向后兼容性的模块将被移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.admin.util</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.db.backends.util</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.backends.util</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.forms.util</code></p></li>\n</ul>\n</li>\n<li><p><code class=\"docutils literal notranslate\">ModelAdmin.get_formsets</code> 将被移除。</p></li>\n<li><p>将移除为了将 <code class=\"docutils literal notranslate\">BaseMemcachedCache._get_memcache_timeout()</code> 方法重命名为 <code class=\"docutils literal notranslate\">get_backend_timeout()</code> 而引入的向后兼容 shim。</p></li>\n<li><p><code class=\"docutils literal notranslate\">--natural</code> 和 <code class=\"docutils literal notranslate\">-n</code> 选项将被移除，用于 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/django-admin/#django-admin-dumpdata\"><code class=\"xref std std-djadmin docutils literal notranslate\">dumpdata</code></a>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">serializers.serialize()</code> 的 <code class=\"docutils literal notranslate\">use_natural_keys</code> 参数将被移除。</p></li>\n<li><p>私有 API <code class=\"docutils literal notranslate\">django.forms.forms.get_declared_fields()</code> 将被移除。</p></li>\n<li><p>将移除使用 <code class=\"docutils literal notranslate\">SplitDateTimeWidget</code> 与 <code class=\"docutils literal notranslate\">DateTimeField</code> 的能力。</p></li>\n<li><p>将移除 <code class=\"docutils literal notranslate\">WSGIRequest.REQUEST</code> 属性。</p></li>\n<li><p>类 <code class=\"docutils literal notranslate\">django.utils.datastructures.MergeDict</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">zh-cn</code> 和 <code class=\"docutils literal notranslate\">zh-tw</code> 语言代码将被移除，并分别被 <code class=\"docutils literal notranslate\">zh-hans</code> 和 <code class=\"docutils literal notranslate\">zh-hant</code> 语言代码替代。</p></li>\n<li><p>内部的 <code class=\"docutils literal notranslate\">django.utils.functional.memoize</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.cache.get_cache</code> 将被移除。请在 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/settings/#std-setting-CACHES\"><code class=\"xref std std-setting docutils literal notranslate\">CACHES</code></a> 中添加适当的条目，并改用 <a class=\"reference internal\" href=\"/zh-hans/6.0/topics/cache/#django.core.cache.caches\" title=\"django.core.cache.caches\"><code class=\"xref py py-data docutils literal notranslate\">django.core.cache.caches</code></a>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.loading</code> 将被移除。</p></li>\n<li><p>将不再支持将可调用参数传递给查询集。</p></li>\n<li><p><code class=\"docutils literal notranslate\">BaseCommand.requires_model_validation</code> 将被移除，取而代之的是 <code class=\"docutils literal notranslate\">requires_system_checks</code>。管理验证器将被管理检查取代。</p></li>\n<li><p><code class=\"docutils literal notranslate\">ModelAdmin.validator_class</code> 和 <code class=\"docutils literal notranslate\">default_validator_class</code> 属性将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">ModelAdmin.validate()</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.backends.DatabaseValidation.validate_field</code> 将被移除，取而代之的是 <code class=\"docutils literal notranslate\">check_field</code> 方法。</p></li>\n<li><p><code class=\"docutils literal notranslate\">validate</code> 管理命令将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.module_loading.import_by_path</code> 将被移除，取而代之的是 <code class=\"docutils literal notranslate\">django.utils.module_loading.import_string</code>。</p></li>\n<li><p><a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>ssi``和`url``模板标签将从`future``模板标签库中删除(在1.3/1.4弃用期内使用)。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.text.javascript_quote</code> 将被移除。</p></li>\n<li><p>将不再支持数据库测试设置作为独立的数据库设置条目，以 <code class=\"docutils literal notranslate\">TEST_</code> 为前缀。</p></li>\n<li><p>将移除对 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/forms/fields/#django.forms.ModelChoiceField\" title=\"django.forms.ModelChoiceField\"><code class=\"xref py py-class docutils literal notranslate\">ModelChoiceField</code></a> 和 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/forms/fields/#django.forms.ModelMultipleChoiceField\" title=\"django.forms.ModelMultipleChoiceField\"><code class=\"xref py py-class docutils literal notranslate\">ModelMultipleChoiceField</code></a> 的 <code class=\"docutils literal notranslate\">cache_choices</code> 选项支持。</p></li>\n<li><p><a class=\"reference internal\" href=\"/zh-hans/6.0/ref/class-based-views/base/#django.views.generic.base.RedirectView.permanent\" title=\"django.views.generic.base.RedirectView.permanent\"><code class=\"xref py py-attr docutils literal notranslate\">RedirectView.permanent</code></a> 属性的默认值将从 <code class=\"docutils literal notranslate\">True</code> 更改为 <code class=\"docutils literal notranslate\">False</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.sitemaps.FlatPageSitemap</code> 将被移除，取而代之的是 <code class=\"docutils literal notranslate\">django.contrib.flatpages.sitemaps.FlatPageSitemap</code>。</p></li>\n<li><p>私有 API <code class=\"docutils literal notranslate\">django.test.utils.TestTemplateLoader</code> 将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.contenttypes.generic</code> 模块将被移除。</p></li>\n<li><p>私有 API <code class=\"docutils literal notranslate\">django.db.models.sql.where.WhereNode.make_atom()</code> 和 <code class=\"docutils literal notranslate\">django.db.models.sql.where.Constraint</code> 将被移除。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-1-8\">\n<span id=\"id14\"></span><h2>1.8<a class=\"heading-anchor\" href=\"#deprecation-removed-in-1-8\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.6/#deprecated-features-1-6\"><span class=\"std std-ref\">Django 1.6 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.contrib.comments</code> 将被移除。</p></li>\n<li><p>以下事务管理 API 将被移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">TransactionMiddleware</code>,</p></li>\n<li><p>在 <code class=\"docutils literal notranslate\">django.db.transaction</code> 中定义的装饰器和上下文管理器 <code class=\"docutils literal notranslate\">autocommit</code>、<code class=\"docutils literal notranslate\">commit_on_success</code> 和 <code class=\"docutils literal notranslate\">commit_manually</code> 将被移除。</p></li>\n<li><p>在 <code class=\"docutils literal notranslate\">django.db.transaction</code> 中定义的函数 <code class=\"docutils literal notranslate\">commit_unless_managed</code> 和 <code class=\"docutils literal notranslate\">rollback_unless_managed</code> 也将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">TRANSACTIONS_MANAGED</code> 设置也将被移除。</p></li>\n</ul>\n</li>\n<li><p><a class=\"reference internal\" href=\"/zh-hans/6.0/ref/templates/builtins/#std-templatetag-cycle\"><code class=\"xref std std-ttag docutils literal notranslate\">cycle</code></a> 和 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/templates/builtins/#std-templatetag-firstof\"><code class=\"xref std std-ttag docutils literal notranslate\">firstof</code></a> 模板标签将自动转义它们的参数。在 1.6 和 1.7 版本中，这一行为由位于 <code class=\"docutils literal notranslate\">future</code> 模板标签库中的这些标签的版本提供。</p></li>\n<li><p><code class=\"docutils literal notranslate\">SEND_BROKEN_LINK_EMAILS</code> 设置将被移除。请将 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/middleware/#django.middleware.common.BrokenLinkEmailsMiddleware\" title=\"django.middleware.common.BrokenLinkEmailsMiddleware\"><code class=\"xref py py-class docutils literal notranslate\">django.middleware.common.BrokenLinkEmailsMiddleware</code></a> 中间件添加到你的 <code class=\"docutils literal notranslate\">MIDDLEWARE_CLASSES</code> 设置中。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.middleware.doc.XViewMiddleware</code> 将被移除。请改用 <code class=\"docutils literal notranslate\">django.contrib.admindocs.middleware.XViewMiddleware</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">Model._meta.module_name</code> 已重命名为 <code class=\"docutils literal notranslate\">model_name</code>。</p></li>\n<li><p>移除了用于重命名 <code class=\"docutils literal notranslate\">get_query_set</code> 和类似 queryset 方法的向后兼容的 shims。这影响到以下类：<code class=\"docutils literal notranslate\">BaseModelAdmin</code>、<code class=\"docutils literal notranslate\">ChangeList</code>、<code class=\"docutils literal notranslate\">BaseCommentNode</code>、<code class=\"docutils literal notranslate\">GenericForeignKey</code>、<code class=\"docutils literal notranslate\">Manager</code>、<code class=\"docutils literal notranslate\">SingleRelatedObjectDescriptor</code> 和 <code class=\"docutils literal notranslate\">ReverseSingleRelatedObjectDescriptor</code>。</p></li>\n<li><p>移除了用于重命名属性 <code class=\"docutils literal notranslate\">ChangeList.root_query_set</code> 和 <code class=\"docutils literal notranslate\">ChangeList.query_set</code> 的向后兼容的 shims。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.views.defaults.shortcut</code> 将被移除，作为从核心 Django 代码库中移除所有 <code class=\"docutils literal notranslate\">django.contrib</code> 引用的目标的一部分。请改用 <code class=\"docutils literal notranslate\">django.contrib.contenttypes.views.shortcut</code>。同时，<code class=\"docutils literal notranslate\">django.conf.urls.shortcut</code> 也将被移除。</p></li>\n<li><p>对于 Python Imaging Library (PIL) 模块的支持将被移除，因为它似乎不再积极维护，并且不支持 Python 3。</p></li>\n<li><p>以下私有 API 将被移除：</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\">django.db.backend</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.close_connection()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.backends.creation.BaseDatabaseCreation.set_autocommit()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.transaction.is_managed()</code></p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.transaction.managed()</code></p></li>\n</ul>\n</li>\n<li><p><code class=\"docutils literal notranslate\">django.forms.widgets.RadioInput</code> 将被移除，取而代之的是 <code class=\"docutils literal notranslate\">django.forms.widgets.RadioChoiceInput</code>。</p></li>\n<li><p>模块 <code class=\"docutils literal notranslate\">django.test.simple</code> 和类 <code class=\"docutils literal notranslate\">django.test.simple.DjangoTestSuiteRunner</code> 将被移除。请改用 <code class=\"docutils literal notranslate\">django.test.runner.DiscoverRunner</code>。</p></li>\n<li><p>模块 <code class=\"docutils literal notranslate\">django.test._doctest</code> 将被移除。请改用 Python 标准库中的 doctest 模块。</p></li>\n<li><p><code class=\"docutils literal notranslate\">CACHE_MIDDLEWARE_ANONYMOUS_ONLY</code> 设置将被移除。</p></li>\n<li><p>Usage of the hardcoded <em>Hold down &quot;Control&quot;, or &quot;Command&quot; on a Mac, to select\nmore than one.</em> string to override or append to user-provided <code class=\"docutils literal notranslate\">help_text</code>\nin forms for ManyToMany model fields will not be performed by Django anymore\neither at the model or forms layer.</p></li>\n<li><p><code class=\"docutils literal notranslate\">Model._meta.get_(add|change|delete)_permission</code> 方法将被移除。</p></li>\n<li><p>会话键 <code class=\"docutils literal notranslate\">django_language</code> 不再读取以保持向后兼容性。</p></li>\n<li><p>地理 Sitemaps 将被移除（<code class=\"docutils literal notranslate\">django.contrib.gis.sitemaps.views.index</code> 和 <code class=\"docutils literal notranslate\">django.contrib.gis.sitemaps.views.sitemap</code>）。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.html.fix_ampersands</code>、<code class=\"docutils literal notranslate\">fix_ampersands</code> 模板过滤器和 <code class=\"docutils literal notranslate\">django.utils.html.clean_html</code> 将在加速弃用后被移除。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-1-7\">\n<span id=\"id15\"></span><h2>1.7<a class=\"heading-anchor\" href=\"#deprecation-removed-in-1-7\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.5/#deprecated-features-1-5\"><span class=\"std std-ref\">Django 1.5 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p>模块 <code class=\"docutils literal notranslate\">django.utils.simplejson</code> 将被移除。应该改用标准库中的 <a class=\"reference external\" href=\"https://docs.python.org/3/library/json.html#module-json\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">json</code></a>。</p></li>\n<li><p>函数``django.utils.itercompat.product`将被删除。应该使用Python内置版本。</p></li>\n<li><p>当INSTALLED_APPS和TEMPLATE_DIRS设置被指定为普通字符串而不是元组时，它们的自动更正将被移除并引发异常。</p></li>\n<li><p><code class=\"docutils literal notranslate\">mimetype</code> 参数将被从 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a>、<a class=\"reference internal\" href=\"/zh-hans/6.0/ref/template-response/#django.template.response.SimpleTemplateResponse\" title=\"django.template.response.SimpleTemplateResponse\"><code class=\"xref py py-class docutils literal notranslate\">SimpleTemplateResponse</code></a> 和 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/template-response/#django.template.response.TemplateResponse\" title=\"django.template.response.TemplateResponse\"><code class=\"xref py py-class docutils literal notranslate\">TemplateResponse</code></a> 的 <code class=\"docutils literal notranslate\">__init__</code> 方法中移除。应该改用 <code class=\"docutils literal notranslate\">content_type</code>。这也适用于 <code class=\"docutils literal notranslate\">render_to_response()</code> 快捷方式以及站点地图视图 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/contrib/sitemaps/#django.contrib.sitemaps.views.index\" title=\"django.contrib.sitemaps.views.index\"><code class=\"xref py py-func docutils literal notranslate\">index()</code></a> 和 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/contrib/sitemaps/#django.contrib.sitemaps.views.sitemap\" title=\"django.contrib.sitemaps.views.sitemap\"><code class=\"xref py py-func docutils literal notranslate\">sitemap()</code></a>。</p></li>\n<li><p>当使用迭代器实例化 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/request-response/#django.http.HttpResponse\" title=\"django.http.HttpResponse\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponse</code></a>，或者当将 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/request-response/#django.http.HttpResponse.content\" title=\"django.http.HttpResponse.content\"><code class=\"xref py py-attr docutils literal notranslate\">content</code></a> 设置为迭代器时，该迭代器将被立即消耗。</p></li>\n<li><p><code class=\"docutils literal notranslate\">AUTH_PROFILE_MODULE</code> 设置以及 User 模型上的 <code class=\"docutils literal notranslate\">get_profile()</code> 方法将被移除。</p></li>\n<li><p><a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>cleanup``管理命令将被删除。它被``clearsessions``所取代。</p></li>\n<li><p>daily_cleanup.py 脚本将会被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">depth</code> 关键字参数将从 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.select_related\" title=\"django.db.models.query.QuerySet.select_related\"><code class=\"xref py py-meth docutils literal notranslate\">select_related()</code></a> 中移除。</p></li>\n<li><p>来自 <a class=\"reference internal\" href=\"/zh-hans/6.0/topics/testing/advanced/#module-django.test.utils\" title=\"django.test.utils: Helpers to write custom test runners.\"><code class=\"xref py py-mod docutils literal notranslate\">django.test.utils</code></a> 的未记录文档的 <code class=\"docutils literal notranslate\">get_warnings_state()</code>/<code class=\"docutils literal notranslate\">restore_warnings_state()</code> 函数以及 <a class=\"reference internal\" href=\"/zh-hans/6.0/topics/testing/tools/#django-testcase-subclasses\"><span class=\"std std-ref\">django.test.*TestCase</span></a> 中的 <code class=\"docutils literal notranslate\">save_warnings_state()</code>/ <code class=\"docutils literal notranslate\">restore_warnings_state()</code> 方法已被弃用。应该使用从 Python 2.6 开始可用的 <a class=\"reference external\" href=\"https://docs.python.org/3/library/warnings.html#warnings.catch_warnings\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">warnings.catch_warnings</code></a> 上下文管理器。</p></li>\n<li><p>在 <a class=\"reference internal\" href=\"/zh-hans/6.0/topics/auth/default/#django.contrib.auth.forms.AuthenticationForm\" title=\"django.contrib.auth.forms.AuthenticationForm\"><code class=\"xref py py-class docutils literal notranslate\">AuthenticationForm</code></a> 中未记录的 <code class=\"docutils literal notranslate\">check_for_test_cookie</code> 方法将在加速弃用后被移除。用户子类化这个表单的应该移除对这个方法的调用，并确保他们的身份验证相关视图启用了 CSRF 保护，以确保启用了 cookies。</p></li>\n<li><p>支持 base36 编码用户 ID（<code class=\"docutils literal notranslate\">django.contrib.auth.views.password_reset_confirm_uidb36</code>）的 <code class=\"docutils literal notranslate\">django.contrib.auth.views.password_reset_confirm()</code> 版本将被移除。如果你的站点在 Django 1.6 上运行时间超过了 <code class=\"docutils literal notranslate\">PASSWORD_RESET_TIMEOUT_DAYS</code>，这个更改不会产生影响。如果没有，那么在升级到 Django 1.7 之前生成的任何密码重置链接在升级后将不起作用。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.encoding.StrAndUnicode</code> 混合类将被移除。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-1-6\">\n<span id=\"id16\"></span><h2>1.6<a class=\"heading-anchor\" href=\"#deprecation-removed-in-1-6\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.4/#deprecated-features-1-4\"><span class=\"std std-ref\">Django 1.4 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">django.contrib.databrowse</code> 将来会被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.localflavor</code> 将会被加快移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.markup</code> 将会被加快移除。</p></li>\n<li><p>兼容性模块 <code class=\"docutils literal notranslate\">django.utils.copycompat</code> 和 <code class=\"docutils literal notranslate\">django.utils.hashcompat</code> 以及函数 <code class=\"docutils literal notranslate\">django.utils.itercompat.all</code> 和 <code class=\"docutils literal notranslate\">django.utils.itercompat.any</code> 将会被移除。应该使用Python内置版本。</p></li>\n<li><p><code class=\"docutils literal notranslate\">csrf_response_exempt</code> 和 <code class=\"docutils literal notranslate\">csrf_view_exempt</code> 装饰器将被删除。 从1.4开始， <code class=\"docutils literal notranslate\">csrf_response_exempt</code> 已成为空操作（它返回相同的功能），而 <code class=\"docutils literal notranslate\">csrf_view_exempt</code> 已成为 <code class=\"docutils literal notranslate\">django.views.decorators.csrf.csrf_exempt</code> 的同义词以取代它。</p></li>\n<li><p>原有缓存后端 <code class=\"docutils literal notranslate\">django.core.cache.backends.memcached.CacheClass</code> 后端在Django 1.3中分为两个，以引入对PyLibMC的支持。历史悠久的 <code class=\"docutils literal notranslate\">CacheClass</code> 将会被删除，取而代之的是缓存后端 <code class=\"docutils literal notranslate\">django.core.cache.backends.memcached.MemcachedCache</code> 。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.localflavor.uk</code> 的英国前缀对象只能通过其GB前缀名称来访问（GB是英国的正确ISO 3166代码）。</p></li>\n<li><p><code class=\"docutils literal notranslate\">IGNORABLE_404_STARTS</code> 和 <code class=\"docutils literal notranslate\">IGNORABLE_404_ENDS</code> 设置在 1.4 版本中已被 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/settings/#std-setting-IGNORABLE_404_URLS\"><code class=\"xref std std-setting docutils literal notranslate\">IGNORABLE_404_URLS</code></a> 取代。它们将被移除。</p></li>\n<li><p>在 1.4 版本中，表单向导已经重构为使用基于类的视图，并具有可插拔的后端。之前的实现将被移除。</p></li>\n<li><p>删除 <a class=\"reference internal\" href=\"/zh-hans/6.0/topics/cache/#django.views.decorators.cache.cache_page\" title=\"django.views.decorators.cache.cache_page\"><code class=\"xref py py-func docutils literal notranslate\">cache_page()</code></a> 缓存的旧版调用方式。</p></li>\n<li><p>向后兼容的填充程序会自动向 <code class=\"docutils literal notranslate\">'mail_admins'</code> 日志记录处理程序中添加一个debug-false过滤器。 如果需要的话，日志配置 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/settings/#std-setting-LOGGING\"><code class=\"xref std std-setting docutils literal notranslate\">LOGGING</code></a> 配置应该显式地包括这个过滤器。</p></li>\n<li><p>内置的截断函数 <code class=\"docutils literal notranslate\">django.utils.text.truncate_words()</code> 和 <code class=\"docutils literal notranslate\">django.utils.text.truncate_html_words()</code> 将被移除，取而代之的是 <code class=\"docutils literal notranslate\">django.utils.text.Truncator</code> 类。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.geoip.GeoIP</code> 类在 1.4 版本中已移动到 <code class=\"docutils literal notranslate\">django.contrib.gis.geoip</code> 中，<code class=\"docutils literal notranslate\">django.contrib.gis.utils</code> 中的快捷方式将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.conf.urls.defaults</code> 将被移除。函数 <code class=\"docutils literal notranslate\">include()</code>, <code class=\"docutils literal notranslate\">patterns()</code>, 和 <code class=\"docutils literal notranslate\">url()</code>，以及 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/urls/#django.conf.urls.handler404\" title=\"django.conf.urls.handler404\"><code class=\"xref py py-data docutils literal notranslate\">handler404</code></a> 和 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/urls/#django.conf.urls.handler500\" title=\"django.conf.urls.handler500\"><code class=\"xref py py-data docutils literal notranslate\">handler500</code></a> 现在可以通过 <code class=\"docutils literal notranslate\">django.conf.urls</code> 使用。</p></li>\n<li><p>函数 <code class=\"docutils literal notranslate\">setup_environ()</code> 和 <code class=\"docutils literal notranslate\">execute_manager()</code> 将从 <a class=\"reference internal\" href=\"/zh-hans/6.0/howto/custom-management-commands/#module-django.core.management\" title=\"django.core.management\"><code class=\"xref py py-mod docutils literal notranslate\">django.core.management</code></a> 中移除。这也意味着旧的（1.4 版本之前的） <code class=\"file docutils literal notranslate\">manage.py</code> 文件的风格将不再起作用。</p></li>\n<li><p>不再支持将 <code class=\"docutils literal notranslate\">is_safe</code> 和 <code class=\"docutils literal notranslate\">needs_autoescape</code> 标志设置为模板过滤器函数的属性。</p></li>\n<li><p>在 1.4 版本中，属性 <code class=\"docutils literal notranslate\">HttpRequest.raw_post_data</code> 已重命名为 <code class=\"docutils literal notranslate\">HttpRequest.body</code>。向后兼容性将被移除，<code class=\"docutils literal notranslate\">HttpRequest.raw_post_data</code> 将不再起作用。</p></li>\n<li><p>在 <code class=\"docutils literal notranslate\">ModelAdmin.response_add()</code> 中，<code class=\"docutils literal notranslate\">post_url_continue</code> 参数的值必须是 <code class=\"docutils literal notranslate\">None``（以重定向到新创建的对象的编辑页面）或预格式化的 URL。不再接受字符串格式，例如之前的默认值 ``'../%s/'</code>。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-1-5\">\n<span id=\"id17\"></span><h2>1.5<a class=\"heading-anchor\" href=\"#deprecation-removed-in-1-5\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.3/#deprecated-features-1-3\"><span class=\"std std-ref\">Django 1.3 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p>启动没有 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/settings/#std-setting-SECRET_KEY\"><code class=\"xref std std-setting docutils literal notranslate\">SECRET_KEY</code></a> 的 Django 将引发异常而不是 <code class=\"docutils literal notranslate\">DeprecationWarning</code>。这是从通常的弃用路径加速过来的（参见 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.4/\"><span class=\"doc\">Django 1.4 发布说明</span></a>）。</p></li>\n<li><p><code class=\"docutils literal notranslate\">mod_python</code> 请求处理程序将被移除。应该改用 <code class=\"docutils literal notranslate\">mod_wsgi</code> 处理程序。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.test.client.Response</code> 对象上的 <code class=\"docutils literal notranslate\">template</code> 属性将被移除。应该改用 <a class=\"reference internal\" href=\"/zh-hans/6.0/topics/testing/tools/#django.test.Response.templates\" title=\"django.test.Response.templates\"><code class=\"xref py py-attr docutils literal notranslate\">templates</code></a> 属性。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.test.simple.DjangoTestRunner</code> 将被移除。而应该使用 <code class=\"docutils literal notranslate\">unittest</code> 的原生类。<code class=\"docutils literal notranslate\">django.test.simple.DjangoTestRunner</code> 的功能（包括快速失败和 Ctrl-C 测试终止）可以由 <a class=\"reference external\" href=\"https://docs.python.org/3/library/unittest.html#unittest.TextTestRunner\" title=\"(in Python v3.14)\"><code class=\"xref py py-class docutils literal notranslate\">unittest.TextTestRunner</code></a> 提供。</p></li>\n<li><p>未记录的函数 <code class=\"docutils literal notranslate\">django.contrib.formtools.utils.security_hash</code> 将被移除，应该改用 <code class=\"docutils literal notranslate\">django.contrib.formtools.utils.form_hmac</code>。</p></li>\n<li><p>基于函数的通用视图模块将被移除，应该使用它们的基于类的等效模块，详情请参考 <a class=\"reference internal\" href=\"/zh-hans/6.0/topics/class-based-views/\"><span class=\"doc\">这里</span></a>。</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">django.core.servers.basehttp.AdminMediaHandler</code> will be\nremoved. In its place use\n<code class=\"docutils literal notranslate\">django.contrib.staticfiles.handlers.StaticFilesHandler</code>.</p></li>\n<li><p>模板标签库 <code class=\"docutils literal notranslate\">adminmedia</code> 和模板标签 <code class=\"docutils literal notranslate\">{% admin_media_prefix %}</code> 将被移除，取而代之的是通用的静态文件处理方式。（这比通常的弃用路径更快，参见 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.4/\"><span class=\"doc\">Django 1.4 发布说明</span></a>。）</p></li>\n<li><p><code class=\"docutils literal notranslate\">url</code> 和 <code class=\"docutils literal notranslate\">ssi</code> 模板标签将被修改，使每个标签的第一个参数是一个模板变量，而不是隐含的字符串。在 1.4 版本中，这个行为由 <code class=\"docutils literal notranslate\">future</code> 模板标签库中的标签版本提供。</p></li>\n<li><p><code class=\"docutils literal notranslate\">reset</code> 和 <code class=\"docutils literal notranslate\">sqlreset</code> 管理命令将被移除。</p></li>\n<li><p>身份验证后端需要支持将非活动用户传递给处理权限的所有方法。不再检查 <code class=\"docutils literal notranslate\">supports_inactive_user</code> 属性，并且可以从自定义后端中移除。</p></li>\n<li><p>在没有 SRID 值的几何体上调用 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.transform\" title=\"django.contrib.gis.geos.GEOSGeometry.transform\"><code class=\"xref py py-meth docutils literal notranslate\">transform()</code></a> 将引发 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSException\" title=\"django.contrib.gis.geos.GEOSException\"><code class=\"xref py py-class docutils literal notranslate\">GEOSException</code></a>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.http.CompatCookie</code> 将被移除，应该使用 <code class=\"docutils literal notranslate\">django.http.SimpleCookie</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.context_processors.PermWrapper</code> 和 <code class=\"docutils literal notranslate\">django.core.context_processors.PermLookupDict</code> 将被移除，分别应该使用相应的 <code class=\"docutils literal notranslate\">django.contrib.auth.context_processors.PermWrapper</code> 和 <code class=\"docutils literal notranslate\">django.contrib.auth.context_processors.PermLookupDict</code>。</p></li>\n<li><p><a class=\"reference internal\" href=\"/zh-hans/6.0/ref/settings/#std-setting-MEDIA_URL\"><code class=\"xref std std-setting docutils literal notranslate\">MEDIA_URL</code></a> 或 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/settings/#std-setting-STATIC_URL\"><code class=\"xref std std-setting docutils literal notranslate\">STATIC_URL</code></a> 设置将需要以斜杠结尾，以确保在模板中有一种一致的方法来组合路径。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.fields.URLField.verify_exists</code> 将被移除。由于难以解决的安全和性能问题，该功能在 1.3.1 版本中已被弃用，并将遵循略微加速的弃用时间表。</p></li>\n<li><p>在运行时进行的翻译构建过程中，位于所谓的 <em>项目路径</em> 下的翻译将被忽略。可以使用 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/settings/#std-setting-LOCALE_PATHS\"><code class=\"xref std std-setting docutils literal notranslate\">LOCALE_PATHS</code></a> 设置执行相同的任务，其中包括非应用程序特定翻译的文件系统路径，该路径包含在其值中的 <code class=\"docutils literal notranslate\">locale</code> 目录中。</p></li>\n<li><p>Markup contrib 应用程序将不再支持早于 2.1 版本的 Python-Markdown 库。由于这是与安全性相关的弃用，采用了加速的时间表。</p></li>\n<li><p><code class=\"docutils literal notranslate\">CACHE_BACKEND</code> 设置将被移除。缓存后端应该在 <a class=\"reference internal\" href=\"/zh-hans/6.0/ref/settings/#std-setting-CACHES\"><code class=\"xref std std-setting docutils literal notranslate\">CACHES</code></a> 设置中指定。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-1-4\">\n<span id=\"id18\"></span><h2>1.4<a class=\"heading-anchor\" href=\"#deprecation-removed-in-1-4\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.2/#deprecated-features-1-2\"><span class=\"std std-ref\">Django 1.2 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">CsrfResponseMiddleware</code> and <code class=\"docutils literal notranslate\">CsrfMiddleware</code> will be removed. Use\nthe <code class=\"docutils literal notranslate\">{% csrf_token %}</code> template tag inside forms to enable CSRF\nprotection. <code class=\"docutils literal notranslate\">CsrfViewMiddleware</code> remains and is enabled by default.</p></li>\n<li><p>CSRF 功能的旧导入（<code class=\"docutils literal notranslate\">django.contrib.csrf.*</code>）已在 1.2 版本中移动到核心，它们将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.gis.db.backend</code> 模块将被移除，取而代之的是特定的后端模块。</p></li>\n<li><p><code class=\"docutils literal notranslate\">SMTPConnection</code> 将被移除，取而代之的是通用的电子邮件后端 API。</p></li>\n<li><p>数据库后端上的许多对多 SQL 生成函数将被移除。</p></li>\n<li><p>使用 <code class=\"docutils literal notranslate\">DATABASE_*</code> 顶级设置来定义数据库连接的能力将被移除。</p></li>\n<li><p>使用简写符号来指定数据库后端（例如，<code class=\"docutils literal notranslate\">sqlite3</code> 而不是 <code class=\"docutils literal notranslate\">django.db.backends.sqlite3</code>）的能力将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">get_db_prep_save</code>、<code class=\"docutils literal notranslate\">get_db_prep_value</code> 和 <code class=\"docutils literal notranslate\">get_db_prep_lookup</code> 方法将需要支持多个数据库。</p></li>\n<li><p>The <code class=\"docutils literal notranslate\">Message</code> model (in <code class=\"docutils literal notranslate\">django.contrib.auth</code>), its related\nmanager in the <code class=\"docutils literal notranslate\">User</code> model (<code class=\"docutils literal notranslate\">user.message_set</code>), and the\nassociated methods (<code class=\"docutils literal notranslate\">user.message_set.create()</code> and\n<code class=\"docutils literal notranslate\">user.get_and_delete_messages()</code>), will be removed. The\n<a class=\"reference internal\" href=\"/zh-hans/6.0/ref/contrib/messages/\"><span class=\"doc\">messages framework</span></a> should be used\ninstead. The related <code class=\"docutils literal notranslate\">messages</code> variable returned by the\nauth context processor will also be removed. Note that this\nmeans that the admin application will depend on the messages\ncontext processor.</p></li>\n<li><p>身份验证后端需要支持 <code class=\"docutils literal notranslate\">obj</code> 参数以进行权限检查。不再检查 <code class=\"docutils literal notranslate\">supports_object_permissions</code> 属性，可以从自定义后端中移除。</p></li>\n<li><p>Authentication backends will need to support the <code class=\"docutils literal notranslate\">AnonymousUser</code> class\nbeing passed to all methods dealing with permissions. The\n<code class=\"docutils literal notranslate\">supports_anonymous_user</code> variable will no longer be checked and can be\nremoved from custom backends.</p></li>\n<li><p>指定可调用模板加载器而不是 <code class=\"docutils literal notranslate\">Loader</code> 类的能力将被移除，同时为了向后兼容性而包括在内置模板加载器中的 <code class=\"docutils literal notranslate\">load_template_source</code> 函数也将被移除。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.utils.translation.get_date_formats()</code> 和 <code class=\"docutils literal notranslate\">django.utils.translation.get_partial_date_formats()</code>。这些函数将被移除；使用区域设置感知的 <code class=\"docutils literal notranslate\">django.utils.formats.get_format()</code> 来获取适当的格式。</p></li>\n<li><p>在 <code class=\"docutils literal notranslate\">django.forms.fields</code> 中，常量：<code class=\"docutils literal notranslate\">DEFAULT_DATE_INPUT_FORMATS</code>、<code class=\"docutils literal notranslate\">DEFAULT_TIME_INPUT_FORMATS</code> 和 <code class=\"docutils literal notranslate\">DEFAULT_DATETIME_INPUT_FORMATS</code> 将被移除。使用 <code class=\"docutils literal notranslate\">django.utils.formats.get_format()</code> 来获取适当的格式。</p></li>\n<li><p>将移除使用基于函数的测试运行器的能力，以及 <code class=\"docutils literal notranslate\">django.test.simple.run_tests()</code> 测试运行器。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.contrib.syndication</code> 中的 <code class=\"docutils literal notranslate\">views.feed()</code> 视图和 <code class=\"docutils literal notranslate\">feeds.Feed</code> 类将被移除。应该改用基于类的视图 <code class=\"docutils literal notranslate\">views.Feed</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.context_processors.auth</code>. This release will\nremove the old method in favor of the new method in\n<code class=\"docutils literal notranslate\">django.contrib.auth.context_processors.auth</code>.</p></li>\n<li><p><code class=\"docutils literal notranslate\">postgresql</code> 数据库后端将被移除，应该改用 <code class=\"docutils literal notranslate\">postgresql_psycopg2</code> 后端。</p></li>\n<li><p><code class=\"docutils literal notranslate\">no</code> 语言代码将被移除，已被 <code class=\"docutils literal notranslate\">nb</code> 语言代码替代。</p></li>\n<li><p>身份验证后端需要定义布尔属性 <code class=\"docutils literal notranslate\">supports_inactive_user</code>，直到版本 1.5，届时将假定所有后端都能处理非活动用户。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.db.models.fields.XMLField</code> 将被移除。这在 1.3 版本中已被弃用。由于自从移除了 <code class=\"docutils literal notranslate\">oldforms</code> 后，该字段没有扮演任何角色，因此采用了加速的弃用时间表。所有使用 <code class=\"docutils literal notranslate\">XMLField</code> 的地方可以替换为 <code class=\"docutils literal notranslate\">TextField</code>。</p></li>\n<li><p><code class=\"docutils literal notranslate\">django.core.files.storage.Storage</code> （和其子类）的 <code class=\"docutils literal notranslate\">open()</code> 方法的未记录的 <code class=\"docutils literal notranslate\">mixin</code> 参数将被移除。</p></li>\n</ul>\n</section>\n<section id=\"deprecation-removed-in-1-3\">\n<span id=\"id19\"></span><h2>1.3<a class=\"heading-anchor\" href=\"#deprecation-removed-in-1-3\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>请查看 <a class=\"reference internal\" href=\"/zh-hans/6.0/releases/1.1/#deprecated-features-1-1\"><span class=\"std std-ref\">Django 1.1 发布说明</span></a> 以获取有关这些更改的更多详细信息。</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\">AdminSite.root()</code>. This method of hooking up the admin URLs will be\nremoved in favor of including <code class=\"docutils literal notranslate\">admin.site.urls</code>.</p></li>\n<li><p>身份验证后端需要在 1.4 版本之前定义布尔属性 <code class=\"docutils literal notranslate\">supports_object_permissions</code> 和 <code class=\"docutils literal notranslate\">supports_anonymous_user</code>，在此之后，将假定所有后端都支持这些选项。</p></li>\n</ul>\n</section>","rootId":"django-deprecation-timeline","toc":[{"title":"7.0","anchor":"deprecation-removed-in-7-0","children":[]},{"title":"6.1","anchor":"deprecation-removed-in-6-1","children":[]},{"title":"6.0","anchor":"deprecation-removed-in-6-0","children":[]},{"title":"5.1","anchor":"deprecation-removed-in-5-1","children":[]},{"title":"5.0","anchor":"deprecation-removed-in-5-0","children":[]},{"title":"4.1","anchor":"deprecation-removed-in-4-1","children":[]},{"title":"4.0","anchor":"deprecation-removed-in-4-0","children":[]},{"title":"3.1","anchor":"deprecation-removed-in-3-1","children":[]},{"title":"3.0","anchor":"deprecation-removed-in-3-0","children":[]},{"title":"2.1","anchor":"deprecation-removed-in-2-1","children":[]},{"title":"2.0","anchor":"deprecation-removed-in-2-0","children":[]},{"title":"1.10","anchor":"deprecation-removed-in-1-10","children":[]},{"title":"1.9","anchor":"deprecation-removed-in-1-9","children":[]},{"title":"1.8","anchor":"deprecation-removed-in-1-8","children":[]},{"title":"1.7","anchor":"deprecation-removed-in-1-7","children":[]},{"title":"1.6","anchor":"deprecation-removed-in-1-6","children":[]},{"title":"1.5","anchor":"deprecation-removed-in-1-5","children":[]},{"title":"1.4","anchor":"deprecation-removed-in-1-4","children":[]},{"title":"1.3","anchor":"deprecation-removed-in-1-3","children":[]}],"breadcrumbs":[{"docname":"internals/index","title":"Django内部","url":"/zh-hans/6.0/internals/"}],"prev":{"docname":"internals/release-process","title":"Django 的发行流程","url":"/zh-hans/6.0/internals/release-process/"},"next":{"docname":"internals/git","title":"Django源代码库","url":"/zh-hans/6.0/internals/git/"},"formats":{"html":"/zh-hans/6.0/internals/deprecation/","markdown":"/zh-hans/6.0/internals/deprecation.md","json":"/zh-hans/6.0/internals/deprecation.json"},"source":"https://github.com/django/django/blob/stable/6.0.x/docs/internals/deprecation.txt","official":"https://docs.djangoproject.com/zh-hans/6.0/internals/deprecation/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}