Django 3.0中不推荐使用的及已经删除的功能

3.0中不推荐使用的功能

django.utils.encoding.force_text()smart_text()别名被弃用。如果您的代码支持Python 2,smart_str()并且 force_str()在此处有所不同,请忽略此弃用。

杂项

  • django.utils.http.urlquote()urlquote_plus()urlunquote(),并 urlunquote_plus()在赞成不赞成使用的功能,他们正在别名:urllib.parse.quote()quote_plus(), unquote(),和unquote_plus()
  • django.utils.translation.ugettext()ugettext_lazy(), ugettext_noop()ungettext(),并ungettext_lazy()在赞成不赞成使用的功能,他们正在别名: django.utils.translation.gettext(), gettext_lazy(), gettext_noop(), ngettext(),和 ngettext_lazy()
  • 为了限制会话的创建并因此支持某些缓存策略, django.views.i18n.set_language()将停止在Django 4.0中的会话中设置用户的语言。从Django 2.1开始,该语言始终存储在LANGUAGE_COOKIE_NAMEcookie中。
  • django.utils.text.unescape_entities()不推荐使用 html.unescape()请注意,与不同unescape_entities(),它会 html.unescape()立即评估惰性字符串。
  • 为了避免在有效范围方面造成混淆,将专用内部实用程序is_safe_url()重命名为 url_has_allowed_host_and_scheme()URL具有允许的主机和方案,通常并不表示其“安全”。例如,它可能仍然引用不正确。确保还在iri_to_uri()不可信URL的路径组件上使用 

3.0中删除的功能

这些功能已到弃用周期的尽头,并已在Django 3.0中删除。

有关这些更改的详细信息,请参阅2.0中不推荐使用的功能,包括如何删除对这些功能的使用。

  • django.db.backends.postgresql_psycopg2模块已卸下。
  • django.shortcuts.render_to_response() 已移除。
  • DEFAULT_CONTENT_TYPE设置将被删除。
  • HttpRequest.xreadlines() 已移除。
  • 为支持context的论据Field.from_db_value()和 Expression.convert_value()被删除。
  • 所述field_name的关键字参数QuerySet.earliest()和 latest()被去除。

有关这些更改的详细信息,请参阅2.1中不推荐使用的功能,包括如何删除对这些功能的使用。

  • ForceRHRGIS功能被删除。
  • django.utils.http.cookie_date() 已移除。
  • staticfilesadmin_static模板标签库被删除。
  • django.contrib.staticfiles.templatetags.staticfiles.static() 已移除。

猜你喜欢

转载自www.cnblogs.com/worldinmyeyes/p/12018229.html