3.0 is not recommended to use features
django.utils.encoding.force_text()
Andsmart_text()
的
alias is deprecated. If your code supports Python 2, smart_str()
and force_str()
is different here, please ignore this abandoned.
Miscellaneous
django.utils.http.urlquote()
,urlquote_plus()
,urlunquote()
, Andurlunquote_plus()
in favor of deprecated features, they are Alias: , , , and .urllib.parse.quote()
quote_plus()
unquote()
unquote_plus()
django.utils.translation.ugettext()
,ugettext_lazy()
,ugettext_noop()
,ungettext()
, Andungettext_lazy()
in favor of deprecated features, they are Alias: , , , , and .django.utils.translation.gettext()
gettext_lazy()
gettext_noop()
ngettext()
ngettext_lazy()
- In order to limit the creation of the session and therefore support some caching strategy, it will stop setting the user's session in Django 4.0 in the language. Starting Django 2.1, the language is always stored in a cookie.
django.views.i18n.set_language()
LANGUAGE_COOKIE_NAME
django.utils.text.unescape_entities()
Not recommended . Please note that different , it will immediately assess inert strings.html.unescape()
unescape_entities()
html.unescape()
- To avoid confusion in terms of the effective range, the dedicated internal utility
is_safe_url()
renamedurl_has_allowed_host_and_scheme()
. URL has allowed host and program, it usually does not mean "safe." For example, it may still be incorrect references. Also make sure the URL path component can not be trusted to use .iri_to_uri()
3.0 Delete functions
These features have been abandoned to the end of the cycle, and has been removed in Django 3.0 in.
About more information about these changes, please refer to 2.0 is not recommended to use features, including how to remove the use of these functions.
- The
django.db.backends.postgresql_psycopg2
module is removed. django.shortcuts.render_to_response()
It has been removed.- The
DEFAULT_CONTENT_TYPE
settings will be deleted. HttpRequest.xreadlines()
It has been removed.- In support of
context
the argumentField.from_db_value()
andExpression.convert_value()
is deleted. - The
field_name
keyword parameterQuerySet.earliest()
andlatest()
is removed.
About more information about these changes, please refer to 2.1 is not recommended to use features, including how to remove the use of these functions.
- The
ForceRHR
GIS functionality is removed. django.utils.http.cookie_date()
It has been removed.- In
staticfiles
andadmin_static
is deleted template tag library. django.contrib.staticfiles.templatetags.staticfiles.static()
It has been removed.