Хронология депрекации (устаревания) Django¶
В этом документе описывается, когда различные части Django будут удалены или изменены обратно несовместимым образом после их устаревания в соответствии с :ref:` политикой депрекации <internal-release-deprecation-policy>`. Более подробную информацию о каждом элементе часто можно найти в заметках о выпуске двух предыдущих версий.
4.0¶
См. Django 3.0 примечания к выпуску для получения более подробной информации об этих изменениях.
django.utils.http.urlquote(),urlquote_plus(),urlunquote(), andurlunquote_plus()будет удален.django.utils.encoding.force_text()andsmart_text()будет удален.django.utils.translation.ugettext(),ugettext_lazy(),ugettext_noop(),ungettext(), andungettext_lazy()будет удален.django.views.i18n.set_language()больше не будет set the user language inrequest.session(keydjango.utils.translation.LANGUAGE_SESSION_KEY).alias=Noneбудет обязательным in the signature ofdjango.db.models.Expression.get_group_by_cols()subclasses.django.utils.text.unescape_entities()будет удален.django.utils.http.is_safe_url()будет удален.
См. Django 3.1 примечания к выпуску для получения более подробной информации об этих изменениях.
The
PASSWORD_RESET_TIMEOUT_DAYSsetting будет удален.The undocumented usage of the
isnulllookup with non-boolean values as the right-hand side больше не будет be allowed.The
django.db.models.query_utils.InvalidQueryexception class будет удален.The
django-admin.pyentry point будет удален.The
HttpRequest.is_ajax()метод будет удален.Support for the pre-Django 3.1 encoding format of cookies values used by
django.contrib.messages.storage.cookie.CookieStorageбудет удален.Support for the pre-Django 3.1 password reset tokens in the admin site (that use the SHA-1 hashing algorithm) будет удален.
Support for the pre-Django 3.1 encoding format of sessions будет удален.
Support for the pre-Django 3.1
django.core.signing.Signersignatures (encoded with the SHA-1 algorithm) будет удален.Support for the pre-Django 3.1
django.core.signing.dumps()signatures (encoded with the SHA-1 algorithm) indjango.core.signing.loads()будет удален.Support for the pre-Django 3.1 user sessions (that use the SHA-1 algorithm) будет удален.
The
get_responseargument fordjango.utils.deprecation.MiddlewareMixin.__init__()будет обязательным and won’t acceptNone.The
providing_argsargument fordjango.dispatch.Signalбудет удален.The
lengthargument fordjango.utils.crypto.get_random_string()будет обязательным.The
listmessage forModelMultipleChoiceFieldбудет удален.Support for passing raw column aliases to
QuerySet.order_by()будет удален.The model
NullBooleanFieldбудет удален. A stub field will remain for compatibility with historical migrations.django.conf.urls.url()будет удален.The model
django.contrib.postgres.fields.JSONFieldбудет удален. A stub field will remain for compatibility with historical migrations.django.contrib.postgres.forms.JSONField,django.contrib.postgres.fields.jsonb.KeyTransform, anddjango.contrib.postgres.fields.jsonb.KeyTextTransformбудет удален.The
{% ifequal %}and{% ifnotequal %}template tags будет удален.The
DEFAULT_HASHING_ALGORITHMtransitional setting будет удален.
3.1¶
См. Django 2.2 примечания к выпуску для получения более подробной информации об этих изменениях.
django.utils.timezone.FixedOffsetбудет удален.django.core.paginator.QuerySetPaginatorбудет удален.A model’s
Meta.orderingбольше не будет affectGROUP BYqueries.django.contrib.postgres.fields.FloatRangeFieldanddjango.contrib.postgres.forms.FloatRangeFieldбудет удален.The
FILE_CHARSETsetting будет удален.django.contrib.staticfiles.storage.CachedStaticFilesStorageбудет удален.RemoteUserBackend.configure_user()will requirerequestas the first positional argument.Support for
SimpleTestCase.allow_database_queriesandTransactionTestCase.multi_dbбудет удален.
3.0¶
См. Django 2.0 примечания к выпуску для получения более подробной информации об этих изменениях.
The
django.db.backends.postgresql_psycopg2module будет удален.django.shortcuts.render_to_response()будет удален.The
DEFAULT_CONTENT_TYPEsetting будет удален.HttpRequest.xreadlines()будет удален.Support for the
contextargument ofField.from_db_value()andExpression.convert_value()будет удален.The
field_namekeyword argument ofQuerySet.earliest()andlatest()будет удален.
См. Django 2.1 примечания к выпуску для получения более подробной информации об этих изменениях.
django.contrib.gis.db.models.функцияs.ForceRHRбудет удален.django.utils.http.cookie_date()будет удален.The
staticfilesandadmin_statictemplate tag libraries будет удален.django.contrib.staticfiles.templatetags.static()будет удален.The shim to allow
InlineModelAdmin.has_add_permission()to be defined without anobjargument будет удален.
2.1¶
См. Django 1.11 примечания к выпуску для получения более подробной информации об этих изменениях.
contrib.auth.views.login(),logout(),password_change(),password_change_done(),password_reset(),password_reset_done(),password_reset_confirm(), andpassword_reset_complete()будет удален.The
extra_contextparameter ofcontrib.auth.views.logout_then_login()будет удален.django.test.runner.setup_databases()будет удален.django.utils.translation.string_concat()будет удален.django.core.cache.backends.memcached.PyLibMCCacheбольше не будет support passingpylibmcbehavior settings as top-level attributes ofOPTIONS.The
hostparameter ofdjango.utils.http.is_safe_url()будет удален.Silencing of exceptions raised while rendering the
{% include %}template tag будет удален.DatabaseIntrospection.get_indexes()будет удален.The
authenticate()метод of authentication backends will requirerequestas the first positional argument.The
django.db.models.permalink()decorator будет удален.The
USE_ETAGSsetting будет удален.CommonMiddlewareanddjango.utils.cache.patch_response_headers()больше не будет set ETags.The
Model._meta.has_auto_fieldattribute будет удален.url()“s поддержка inline flags in regular expression groups ((?i),(?L),(?m),(?s), and(?u)) будет удален.Support for
Widget.render()методs without therendererargument будет удален.
2.0¶
См. Django 1.9 примечания к выпуску для получения более подробной информации об этих изменениях.
The
weakargument todjango.dispatch.signals.Signal.disconnect()будет удален.django.db.backends.base.BaseDatabaseOperations.check_aggregate_support()будет удален.The
django.forms.extraspackage будет удален.The
assignment_taghelper будет удален.The
hostargument toassertsRedirectsбудет удален. The compatibility layer which allows absolute URLs to be considered equal to relative ones when the path is identical will also be removed.Field.relбудет удален.Field.remote_field.toattribute будет удален.The
on_deleteargument forForeignKeyandOneToOneFieldбудет обязательным.django.db.models.fields.add_lazy_relation()будет удален.When time zone support is enabled, database backends that don’t support time zones won’t convert aware datetimes to naive values in UTC anymore when such values are passed as parameters to SQL queries executed outside of the ORM, e.g. with
cursor.execute().The
django.contrib.auth.tests.utils.skipIfCustomUser()decorator будет удален.The
GeoManagerandGeoQuerySetclasses будет удален.The
django.contrib.gis.geoipmodule будет удален.The
supports_recursioncheck for template loaders будет удален from:django.template.engine.Engine.find_template()django.template.loader_tags.ExtendsNode.find_template()django.template.loaders.base.Loader.supports_recursion()django.template.loaders.cached.Loader.supports_recursion()
The
load_template()andload_template_sources()template loader методs будет удален.The
template_dirsargument for template loaders будет удален:django.template.loaders.base.Loader.get_template()django.template.loaders.cached.Loader.cache_key()django.template.loaders.cached.Loader.get_template()django.template.loaders.cached.Loader.get_template_sources()django.template.loaders.filesystem.Loader.get_template_sources()
The
django.template.loaders.base.Loader.__call__()метод будет удален.Support for custom error views with a single positional parameter will be dropped.
The
mime_typeattribute ofdjango.utils.feedgenerator.Atom1Feedanddjango.utils.feedgenerator.RssFeedбудет удален in favor ofcontent_type.The
app_nameargument todjango.conf.urls.include()будет удален.Support for passing a 3-tuple as the first argument to
include()будет удален.Support for setting a URL instance namespace without an application namespace будет удален.
Field._get_val_from_obj()будет удален in favor ofField.value_from_object().django.template.loaders.eggs.Loaderбудет удален.The
current_appparameter to thecontrib.authviews будет удален.The
callable_objkeyword argument toSimpleTestCase.assertRaisesMessage()будет удален.Support for the
allow_tagsattribute onModelAdminметодs будет удален.The
enclosurekeyword argument toSyndicationFeed.add_item()будет удален.The
django.template.loader.LoaderOriginanddjango.template.base.StringOriginaliases fordjango.template.base.Originбудет удален.
См. Django 1.10 примечания к выпуску для получения более подробной информации об этих изменениях.
The
makemigrations --exitoption будет удален.Support for direct assignment to a reverse foreign key or many-to-many relation будет удален.
The
get_srid()andset_srid()методs ofdjango.contrib.gis.geos.GEOSGeometryбудет удален.The
get_x(),set_x(),get_y(),set_y(),get_z(), andset_z()методs ofdjango.contrib.gis.geos.Pointбудет удален.The
get_coords()andset_coords()методs ofdjango.contrib.gis.geos.Pointбудет удален.The
cascaded_unionproperty ofdjango.contrib.gis.geos.MultiPolygonбудет удален.django.utils.функцияal.allow_lazy()будет удален.The
shell --plainoption будет удален.The
django.core.urlresolversmodule будет удален.The model
CommaSeparatedIntegerFieldбудет удален. A stub field will remain for compatibility with historical migrations.Support for the template
Context.has_key()метод будет удален.Support for the
django.core.files.storage.Storage.accessed_time(),created_time(), andmodified_time()методs будет удален.Support for query lookups using the model name when
Meta.default_related_nameis set будет удален.The
__searchquery lookup and theDatabaseOperations.fulltext_search_sql()метод будет удален.The shim for supporting custom related manager classes without a
_apply_rel_filters()метод будет удален.Using
User.is_authenticated()andUser.is_anonymous()as методs больше не будет be supported.The private attribute
virtual_fieldsofModel._metaбудет удален.The private keyword arguments
virtual_onlyinField.contribute_to_class()andvirtualinModel._meta.add_field()будет удален.The
javascript_catalog()andjson_catalog()views будет удален.The
django.contrib.gis.utils.precision_wkt()функция будет удален.In multi-table inheritance, implicit promotion of a
OneToOneFieldto aparent_linkбудет удален.Support for
Widget._format_value()будет удален.FileFieldметодsget_directory_name()andget_filename()будет удален.The
mark_for_escaping()функция and the classes it uses:EscapeData,EscapeBytes,EscapeText,EscapeString, andEscapeUnicodeбудет удален.The
escapefilter изменится to usedjango.utils.html.conditional_escape().Manager.use_for_related_fieldsбудет удален.Model
Managerinheritance will follow MRO inheritance rules and theMeta.manager_inheritance_from_futureto opt-in to this behavior будет удален.Support for old-style middleware using
settings.MIDDLEWARE_CLASSESбудет удален.
1.10¶
См. Django 1.8 примечания к выпуску для получения более подробной информации об этих изменениях.
Support for calling a
SQLCompilerdirectly as an alias for calling itsquote_name_unless_aliasметод будет удален.cycleandfirstoftemplate tags будет удален from thefuturetemplate tag library (used during the 1.6/1.7 deprecation period).django.conf.urls.patterns()будет удален.Support for the
prefixargument todjango.conf.urls.i18n.i18n_patterns()будет удален.SimpleTestCase.urlsбудет удален.Using an incorrect count of unpacked values in the
fortemplate tag will raise an exception rather than fail silently.The ability to reverse URLs using a dotted Python path будет удален.
The ability to use a dotted Python path for the
LOGIN_URLandLOGIN_REDIRECT_URLsettings будет удален.Support for
optparsewill be dropped for custom management commands (replaced byargparse).The class
django.core.management.NoArgsCommandбудет удален. UseBaseCommandinstead, which takes no arguments by default.django.core.context_processorsmodule будет удален.django.db.models.sql.aggregatesmodule будет удален.django.contrib.gis.db.models.sql.aggregatesmodule будет удален.The following методs and properties of
django.db.sql.query.Queryбудет удален:Properties:
aggregatesandaggregate_selectMethods:
add_aggregate,set_aggregate_mask, andappend_aggregate_mask.
django.template.resolve_variableбудет удален.The following private APIs будет удален from
django.db.models.options.Options(Model._meta):get_field_by_name()get_all_field_names()get_fields_with_model()get_concrete_fields_with_model()get_m2m_with_model()get_all_related_objects()get_all_related_objects_with_model()get_all_related_many_to_many_objects()get_all_related_m2m_objects_with_model()
The
error_messageargument ofdjango.forms.RegexFieldбудет удален.The
unordered_listfilter больше не будет support old style lists.Support for string
viewarguments tourl()будет удален.The backward compatible shim to rename
django.forms.Form._has_changed()tohas_changed()будет удален.The
removetagstemplate filter будет удален.The
remove_tags()andstrip_entities()функцияs indjango.utils.htmlбудет удален.The
is_admin_siteargument todjango.contrib.auth.views.password_reset()будет удален.django.db.models.field.subclassing.SubfieldBaseбудет удален.django.utils.checksumsбудет удален; its функцияality is included indjango-localflavor1.1+.The
original_content_type_idattribute ondjango.contrib.admin.helpers.InlineAdminFormбудет удален.The backwards compatibility shim to allow
FormMixin.get_form()to be defined with no default value for itsform_classargument будет удален.The following settings будет удален:
ALLOWED_INCLUDE_ROOTSTEMPLATE_CONTEXT_PROCESSORSTEMPLATE_DEBUGTEMPLATE_DIRSTEMPLATE_LOADERSTEMPLATE_STRING_IF_INVALID
The backwards compatibility alias
django.template.loader.BaseLoaderбудет удален.Django template objects returned by
get_template()andselect_template()won’t accept aContextin theirrender()метод anymore.Template response APIs will enforce the use of
dictand backend-dependent template objects instead ofContextandTemplaterespectively.The
current_appparameter for the following функция and classes будет удален:django.shortcuts.render()django.template.Context()django.template.RequestContext()django.template.response.TemplateResponse()
The
dictionaryandcontext_instanceparameters for the following функцияs будет удален:django.shortcuts.render()django.shortcuts.render_to_response()django.template.loader.render_to_string()
The
dirsparameter for the following функцияs будет удален:django.template.loader.get_template()django.template.loader.select_template()django.shortcuts.render()django.shortcuts.render_to_response()
Session verification will be enabled regardless of whether or not
'django.contrib.auth.middleware.SessionAuthenticationMiddleware'is inMIDDLEWARE_CLASSES.Private attribute
django.db.models.Field.relatedбудет удален.The
--listoption of themigratemanagement command будет удален.The
ssitemplate tag будет удален.Support for the
=comparison operator in theiftemplate tag будет удален.The backwards compatibility shims to allow
Storage.get_available_name()andStorage.save()to be defined without amax_lengthargument будет удален.Support for the legacy
%(<foo>)ssyntax inModelFormMixin.success_urlбудет удален.GeoQuerySetaggregate методscollect(),extent(),extent3d(),make_line(), andunionagg()будет удален.Ability to specify
ContentType.namewhen creating a content type instance будет удален.Support for the old signature of
allow_migrateбудет удален. It changed fromallow_migrate(self, db, model)toallow_migrate(self, db, app_label, model_name=None, **hints).Support for the syntax of
{% cycle %}that uses comma-separated arguments будет удален.The warning that
Signerissues when given an invalid separator will become an exception.
1.9¶
См. Django 1.7 примечания к выпуску для получения более подробной информации об этих изменениях.
django.utils.dictconfigбудет удален.django.utils.importlibбудет удален.django.utils.tzinfoбудет удален.django.utils.unittestбудет удален.The
syncdbcommand будет удален.django.db.models.signals.pre_syncdbanddjango.db.models.signals.post_syncdbбудет удален.allow_syncdbon database routers больше не будет automatically becomeallow_migrate.Automatic syncing of apps without migrations будет удален. Migrations will become compulsory for all apps unless you pass the
--run-syncdboption tomigrate.The SQL management commands for apps without migrations,
sql,sqlall,sqlclear,sqldropindexes, andsqlindexes, будет удален.Support for automatic loading of
initial_datafixtures and initial SQL data будет удален.All models will need to be defined inside an installed application or declare an explicit
app_label. Furthermore, it won’t be possible to import them before their application is loaded. In particular, it won’t be possible to import models inside the root package of their application.The model and form
IPAddressFieldбудет удален. A stub field will remain for compatibility with historical migrations.AppCommand.handle_app()больше не будет be supported.RequestSiteandget_current_site()больше не будет be importable fromdjango.contrib.sites.models.FastCGI support via the
runfcgimanagement command будет удален. Please deploy your project using WSGI.django.utils.datastructures.SortedDictбудет удален. Usecollections.OrderedDictfrom the Python standard library instead.ModelAdmin.declared_fieldsetsбудет удален.Instances of
util.pyin the Django codebase have been renamed toutils.pyin an effort to unify all util and utils references. The modules that provided backwards compatibility будет удален:django.contrib.admin.utildjango.contrib.gis.db.backends.utildjango.db.backends.utildjango.forms.util
ModelAdmin.get_formsetsбудет удален.The backward compatibility shim introduced to rename the
BaseMemcachedCache._get_memcache_timeout()метод toget_backend_timeout()будет удален.The
--naturaland-noptions fordumpdataбудет удален.The
use_natural_keysargument forserializers.serialize()будет удален.Private API
django.forms.forms.get_declared_fields()будет удален.The ability to use a
SplitDateTimeWidgetwithDateTimeFieldбудет удален.The
WSGIRequest.REQUESTproperty будет удален.The class
django.utils.datastructures.MergeDictбудет удален.The
zh-cnandzh-twlanguage codes будет удален and have been replaced by thezh-hansandzh-hantlanguage code respectively.The internal
django.utils.функцияal.memoizeбудет удален.django.core.cache.get_cacheбудет удален. Add suitable entries toCACHESand usedjango.core.cache.cachesinstead.django.db.models.loadingбудет удален.Passing callable arguments to querysets больше не будет be possible.
BaseCommand.requires_model_validationбудет удален in favor ofrequires_system_checks. Admin validators will be replaced by admin checks.The
ModelAdmin.validator_classanddefault_validator_classattributes будет удален.ModelAdmin.validate()будет удален.django.db.backends.DatabaseValidation.validate_fieldбудет удален in favor of thecheck_fieldметод.The
validatemanagement command будет удален.django.utils.module_loading.import_by_pathбудет удален in favor ofdjango.utils.module_loading.import_string.ssiandurltemplate tags будет удален from thefuturetemplate tag library (used during the 1.3/1.4 deprecation period).django.utils.text.javascript_quoteбудет удален.Database test settings as independent entries in the database settings, prefixed by
TEST_, больше не будет be supported.The
cache_choicesoption toModelChoiceFieldandModelMultipleChoiceFieldбудет удален.The default value of the
RedirectView.permanentattribute изменится fromTruetoFalse.django.contrib.sitemaps.FlatPageSitemapбудет удален in favor ofdjango.contrib.flatpages.sitemaps.FlatPageSitemap.Private API
django.test.utils.TestTemplateLoaderбудет удален.The
django.contrib.contenttypes.genericmodule будет удален.Private APIs
django.db.models.sql.where.WhereNode.make_atom()anddjango.db.models.sql.where.Constraintбудет удален.
1.8¶
См. Django 1.6 примечания к выпуску для получения более подробной информации об этих изменениях.
django.contrib.commentsбудет удален.The following transaction management APIs будет удален:
TransactionMiddleware,the decorators and context managers
autocommit,commit_on_success, andcommit_manually, defined indjango.db.transaction,the функцияs
commit_unless_managedandrollback_unless_managed, also defined indjango.db.transaction,the
TRANSACTIONS_MANAGEDsetting.
The
cycleandfirstoftemplate tags will auto-escape their arguments. In 1.6 and 1.7, this behavior is provided by the version of these tags in thefuturetemplate tag library.The
SEND_BROKEN_LINK_EMAILSsetting будет удален. Add thedjango.middleware.common.BrokenLinkEmailsMiddlewaremiddleware to yourMIDDLEWARE_CLASSESsetting instead.django.middleware.doc.XViewMiddlewareбудет удален. Usedjango.contrib.admindocs.middleware.XViewMiddlewareinstead.Model._meta.module_namewas renamed tomodel_name.Remove the backward compatible shims introduced to rename
get_query_setand similar queryset методs. This affects the following classes:BaseModelAdmin,ChangeList,BaseCommentNode,GenericForeignKey,Manager,SingleRelatedObjectDescriptorandReverseSingleRelatedObjectDescriptor.Remove the backward compatible shims introduced to rename the attributes
ChangeList.root_query_setandChangeList.query_set.django.views.defaults.shortcutбудет удален, as part of the goal of removing alldjango.contribreferences from the core Django codebase. Instead usedjango.contrib.contenttypes.views.shortcut.django.conf.urls.shortcutwill also be removed.Support for the Python Imaging Library (PIL) module будет удален, as it no longer appears to be actively maintained & does not work on Python 3.
The following private APIs будет удален:
django.db.backenddjango.db.close_connection()django.db.backends.creation.BaseDatabaseCreation.set_autocommit()django.db.transaction.is_managed()django.db.transaction.managed()
django.forms.widgets.RadioInputбудет удален in favor ofdjango.forms.widgets.RadioChoiceInput.The module
django.test.simpleand the classdjango.test.simple.DjangoTestSuiteRunnerбудет удален. Instead usedjango.test.runner.DiscoverRunner.The module
django.test._doctestбудет удален. Instead use the doctest module from the Python standard library.The
CACHE_MIDDLEWARE_ANONYMOUS_ONLYsetting будет удален.Usage of the hard-coded Hold down «Control», or «Command» on a Mac, to select more than one. string to override or append to user-provided
help_textin forms for ManyToMany model fields will not be performed by Django anymore either at the model or forms layer.The
Model._meta.get_(add|change|delete)_permissionметодs будет удален.The session key
django_languageбольше не будет be read for backwards compatibility.Geographic Sitemaps будет удален (
django.contrib.gis.sitemaps.views.indexanddjango.contrib.gis.sitemaps.views.sitemap).django.utils.html.fix_ampersands, thefix_ampersandstemplate filter anddjango.utils.html.clean_htmlбудет удален following an accelerated deprecation.
1.7¶
См. Django 1.5 примечания к выпуску для получения более подробной информации об этих изменениях.
The module
django.utils.simplejsonбудет удален. The standard library providesjsonwhich should be used instead.The функция
django.utils.itercompat.productбудет удален. The Python builtin version should be used instead.Auto-correction of INSTALLED_APPS and TEMPLATE_DIRS settings when they are specified as a plain string instead of a tuple будет удален and raise an exception.
The
mimetypeargument to the__init__методs ofHttpResponse,SimpleTemplateResponse, andTemplateResponse, будет удален.content_typeshould be used instead. This also applies to therender_to_response()shortcut and the sitemap views,index()andsitemap().When
HttpResponseis instantiated with an iterator, or whencontentis set to an iterator, that iterator will be immediately consumed.The
AUTH_PROFILE_MODULEsetting, and theget_profile()метод on the User model, будет удален.The
cleanupmanagement command будет удален. It’s replaced byclearsessions.The
daily_cleanup.pyscript будет удален.The
depthkeyword argument будет удален fromselect_related().The undocumented
get_warnings_state()/restore_warnings_state()функцияs fromdjango.test.utilsand thesave_warnings_state()/restore_warnings_state()django.test.*TestCase методs are deprecated. Use thewarnings.catch_warningscontext manager available starting with Python 2.6 instead.The undocumented
check_for_test_cookieметод inAuthenticationFormбудет удален following an accelerated deprecation. Users subclassing this form should remove calls to this метод, and instead ensure that their auth related views are CSRF protected, which ensures that cookies are enabled.The version of
django.contrib.auth.views.password_reset_confirm()that supports base36 encoded user IDs (django.contrib.auth.views.password_reset_confirm_uidb36) will be removed. If your site has been running Django 1.6 for more thanPASSWORD_RESET_TIMEOUT_DAYS, this change will have no effect. If not, then any password reset links generated before you upgrade to Django 1.7 won’t work after the upgrade.The
django.utils.encoding.StrAndUnicodemix-in будет удален.
1.6¶
См. Django 1.4 примечания к выпуску для получения более подробной информации об этих изменениях.
django.contrib.databrowseбудет удален.django.contrib.localflavorбудет удален following an accelerated deprecation.django.contrib.markupбудет удален following an accelerated deprecation.The compatibility modules
django.utils.copycompatanddjango.utils.hashcompatas well as the функцияsdjango.utils.itercompat.allanddjango.utils.itercompat.anyбудет удален. The Python builtin versions should be used instead.The
csrf_response_exemptandcsrf_view_exemptdecorators будет удален. Since 1.4csrf_response_exempthas been a no-op (it returns the same функция), andcsrf_view_exempthas been a synonym fordjango.views.decorators.csrf.csrf_exempt, which should be used to replace it.The
django.core.cache.backends.memcached.CacheClassbackend was split into two in Django 1.3 in order to introduce поддержка PyLibMC. The historicalCacheClassбудет удален in favor ofdjango.core.cache.backends.memcached.MemcachedCache.The UK-prefixed objects of
django.contrib.localflavor.ukwill only be accessible through their GB-prefixed names (GB is the correct ISO 3166 code for United Kingdom).The
IGNORABLE_404_STARTSandIGNORABLE_404_ENDSsettings have been superseded byIGNORABLE_404_URLSin the 1.4 release. They будет удален.The form wizard has been refactored to use class-based views with pluggable backends in 1.4. The previous implementation будет удален.
Legacy ways of calling
cache_page()будет удален.The backward-compatibility shim to automatically add a debug-false filter to the
'mail_admins'logging handler будет удален. TheLOGGINGsetting should include this filter explicitly if it is desired.The builtin truncation функцияs
django.utils.text.truncate_words()anddjango.utils.text.truncate_html_words()будет удален in favor of thedjango.utils.text.Truncatorclass.The
django.contrib.gis.geoip.GeoIPclass was moved todjango.contrib.gis.geoipin 1.4 – the shortcut indjango.contrib.gis.utilsбудет удален.django.conf.urls.defaultsбудет удален. The функцияsinclude(),patterns(), andurl(), plushandler404andhandler500are now available throughdjango.conf.urls.The функцияs
setup_environ()andexecute_manager()будет удален fromdjango.core.management. This also means that the old (pre-1.4) style ofmanage.pyfile больше не будет work.Setting the
is_safeandneeds_autoescapeflags as attributes of template filter функцияs больше не будет be supported.The attribute
HttpRequest.raw_post_datawas renamed toHttpRequest.bodyin 1.4. The backward compatibility будет удален –HttpRequest.raw_post_dataбольше не будет work.The value for the
post_url_continueparameter inModelAdmin.response_add()will have to be eitherNone(to redirect to the newly created object’s edit page) or a pre-formatted url. String formats, such as the previous default'../%s/', will not be accepted any more.
1.5¶
См. Django 1.3 примечания к выпуску для получения более подробной информации об этих изменениях.
Starting Django without a
SECRET_KEYwill result in an exception rather than aDeprecationWarning. (This is accelerated from the usual deprecation path; see the Django 1.4 примечания к выпуску.)The
mod_pythonrequest handler будет удален. Themod_wsgihandler should be used instead.The
templateattribute ondjango.test.client.Responseobjects returned by the test client будет удален. Thetemplatesattribute should be used instead.The
django.test.simple.DjangoTestRunnerбудет удален. Instead use aunittest-native class. The features of thedjango.test.simple.DjangoTestRunner(including fail-fast and Ctrl-C test termination) can be provided byunittest.TextTestRunner.The undocumented функция
django.contrib.formtools.utils.security_hashбудет удален, instead usedjango.contrib.formtools.utils.form_hmacThe функция-based generic view modules будет удален in favor of their class-based equivalents, outlined here.
The
django.core.servers.basehttp.AdminMediaHandlerбудет удален. In its place usedjango.contrib.staticfiles.handlers.StaticFilesHandler.The template tags library
adminmediaand the template tag{% admin_media_prefix %}будет удален in favor of the generic static files handling. (This is faster than the usual deprecation path; see the Django 1.4 release notes.)The
urlandssitemplate tags will be modified so that the first argument to each tag is a template variable, not an implied string. In 1.4, this behavior is provided by a version of the tag in thefuturetemplate tag library.The
resetandsqlresetmanagement commands будет удален.Authentication backends will need to support an inactive user being passed to all методs dealing with permissions. The
supports_inactive_userattribute больше не будет be checked and can be removed from custom backends.transform()will raise aGEOSExceptionwhen called on a geometry with no SRID value.django.http.CompatCookieбудет удален in favor ofdjango.http.SimpleCookie.django.core.context_processors.PermWrapperanddjango.core.context_processors.PermLookupDictбудет удален in favor of the correspondingdjango.contrib.auth.context_processors.PermWrapperanddjango.contrib.auth.context_processors.PermLookupDict, respectively.The
MEDIA_URLorSTATIC_URLsettings будет обязательным to end with a trailing slash to ensure there is a consistent way to combine paths in templates.django.db.models.fields.URLField.verify_existsбудет удален. The feature was deprecated in 1.3.1 due to intractable security and performance issues and will follow a slightly accelerated deprecation timeframe.Translations located under the so-called project path will be ignored during the translation building process performed at runtime. The
LOCALE_PATHSsetting can be used for the same task by including the filesystem path to alocaledirectory containing non-app-specific translations in its value.The Markup contrib app больше не будет support versions of Python-Markdown library earlier than 2.1. An accelerated timeline was used as this was a security related deprecation.
The
CACHE_BACKENDsetting будет удален. The cache backend(s) should be specified in theCACHESsetting.
1.4¶
См. Django 1.2 примечания к выпуску для получения более подробной информации об этих изменениях.
CsrfResponseMiddlewareandCsrfMiddlewareбудет удален. Use the{% csrf_token %}template tag inside forms to enable CSRF protection.CsrfViewMiddlewareremains and is enabled by default.The old imports for CSRF функцияality (
django.contrib.csrf.*), which moved to core in 1.2, будет удален.The
django.contrib.gis.db.backendmodule будет удален in favor of the specific backends.SMTPConnectionбудет удален in favor of a generic email backend API.The many to many SQL generation функцияs on the database backends будет удален.
The ability to use the
DATABASE_*family of top-level settings to define database connections будет удален.The ability to use shorthand notation to specify a database backend (i.e.,
sqlite3instead ofdjango.db.backends.sqlite3) будет удален.The
get_db_prep_save,get_db_prep_valueandget_db_prep_lookupметодs will have to support multiple databases.The
Messagemodel (indjango.contrib.auth), its related manager in theUsermodel (user.message_set), and the associated методs (user.message_set.create()anduser.get_and_delete_messages()), будет удален. The messages framework should be used instead. The relatedmessagesvariable returned by the auth context processor will also be removed. Note that this means that the admin application will depend on the messages context processor.Authentication backends will need to support the
objparameter for permission checking. Thesupports_object_permissionsattribute больше не будет be checked and can be removed from custom backends.Authentication backends will need to support the
AnonymousUserclass being passed to all методs dealing with permissions. Thesupports_anonymous_uservariable больше не будет be checked and can be removed from custom backends.The ability to specify a callable template loader rather than a
Loaderclass будет удален, as will theload_template_sourceфункцияs that are included with the built in template loaders for backwards compatibility.django.utils.translation.get_date_formats()anddjango.utils.translation.get_partial_date_formats(). These функцияs будет удален; use the locale-awaredjango.utils.formats.get_format()to get the appropriate formats.In
django.forms.fields, the constants:DEFAULT_DATE_INPUT_FORMATS,DEFAULT_TIME_INPUT_FORMATSandDEFAULT_DATETIME_INPUT_FORMATSбудет удален. Usedjango.utils.formats.get_format()to get the appropriate formats.The ability to use a функция-based test runner будет удален, along with the
django.test.simple.run_tests()test runner.The
views.feed()view andfeeds.Feedclass indjango.contrib.syndicationбудет удален. The class-based viewviews.Feedshould be used instead.django.core.context_processors.auth. This release will remove the old метод in favor of the new метод indjango.contrib.auth.context_processors.auth.The
postgresqldatabase backend будет удален, use thepostgresql_psycopg2backend instead.The
nolanguage code будет удален and has been replaced by thenblanguage code.Authentication backends will need to define the boolean attribute
supports_inactive_useruntil version 1.5 when it will be assumed that all backends will handle inactive users.django.db.models.fields.XMLFieldбудет удален. This was deprecated as part of the 1.3 release. An accelerated deprecation schedule has been used because the field hasn’t performed any role beyond that of a simpleTextFieldsince the removal ofoldforms. All uses ofXMLFieldcan be replaced withTextField.The undocumented
mixinparameter to theopen()метод ofdjango.core.files.storage.Storage(and subclasses) будет удален.
1.3¶
См. Django 1.1 примечания к выпуску для получения более подробной информации об этих изменениях.
AdminSite.root(). This метод of hooking up the admin URLs будет удален in favor of includingadmin.site.urls.Authentication backends need to define the boolean attributes
supports_object_permissionsandsupports_anonymous_useruntil version 1.4, at which point it will be assumed that all backends will support these options.