1.8.txt 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577
  1. ============================================
  2. Django 1.8 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. Welcome to Django 1.8!
  5. These release notes cover the `new features`_, as well as some `backwards
  6. incompatible changes`_ you'll want to be aware of when upgrading from Django
  7. 1.7 or older versions. We've also `begun the deprecation process for some
  8. features`_, and some features have reached the end of their deprecation process
  9. and `have been removed`_.
  10. Django 1.8 has been designated as Django's second :ref:`"Long-Term Support"
  11. (LTS) <lts-releases>` release. It will receive security updates for at least
  12. three years after its release. Support for the previous LTS, Django 1.4, will
  13. end 6 months from the release date of Django 1.8.
  14. .. _`new features`: `What's new in Django 1.8`_
  15. .. _`backwards incompatible changes`: `Backwards incompatible changes in 1.8`_
  16. .. _`begun the deprecation process for some features`: `Features deprecated in 1.8`_
  17. .. _`have been removed`: `Features removed in 1.8`_
  18. Python compatibility
  19. ====================
  20. Like Django 1.7, Django 1.8 requires Python 2.7 or above, though we
  21. **highly recommend** the latest minor release.
  22. What's new in Django 1.8
  23. ========================
  24. ``Model._meta`` API
  25. ~~~~~~~~~~~~~~~~~~~
  26. Django now has a formalized API for :doc:`Model._meta </ref/models/meta>`,
  27. providing an officially supported way to :ref:`retrieve fields
  28. <model-meta-field-api>` and filter fields based on their :ref:`attributes
  29. <model-field-attributes>`.
  30. The ``Model._meta`` object has been part of Django since the days of pre-0.96
  31. "Magic Removal" -- it just wasn't an official, stable API. In recognition of
  32. this, we've endeavored to maintain backwards-compatibility with the old
  33. API endpoint where possible. However, API endpoints that aren't part of the
  34. new official API have been deprecated and will eventually be removed. A
  35. :ref:`guide to migrating from the old API to the new API
  36. <migrating-old-meta-api>` has been provided.
  37. Multiple template engines
  38. ~~~~~~~~~~~~~~~~~~~~~~~~~
  39. Django 1.8 defines a stable API for integrating template backends. It includes
  40. built-in support for the Django template language and for Jinja2_. It supports
  41. rendering templates with multiple engines within the same project. Learn more
  42. about the new features in the :doc:`topic guide </topics/templates>` and check
  43. the :doc:`upgrade instructions </ref/templates/upgrading>` for details.
  44. .. _Jinja2: http://jinja.pocoo.org/
  45. Security enhancements
  46. ~~~~~~~~~~~~~~~~~~~~~
  47. Several features of the django-secure_ third-party library have been
  48. integrated into Django. :class:`django.middleware.security.SecurityMiddleware`
  49. provides several security enhancements to the request/response cycle. The new
  50. :djadminopt:`--deploy` option of the :djadmin:`check` command allows you to
  51. check your production settings file for ways to increase the security of your
  52. site.
  53. .. _django-secure: https://pypi.python.org/pypi/django-secure
  54. New PostgreSQL specific functionality
  55. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  56. Django now has a module with extensions for PostgreSQL specific features, such
  57. as :class:`~django.contrib.postgres.fields.ArrayField`,
  58. :class:`~django.contrib.postgres.fields.HStoreField`, :ref:`range-fields`, and
  59. :lookup:`unaccent` lookup. A full breakdown of the features is available
  60. :doc:`in the documentation </ref/contrib/postgres/index>`.
  61. New data types
  62. ~~~~~~~~~~~~~~
  63. * Django now has a :class:`~django.db.models.UUIDField` for storing
  64. universally unique identifiers. It is stored as the native ``uuid`` data type
  65. on PostgreSQL and as a fixed length character field on other backends. There
  66. is a corresponding :class:`form field <django.forms.UUIDField>`.
  67. * Django now has a :class:`~django.db.models.DurationField` for storing periods
  68. of time - modeled in Python by :class:`~python:datetime.timedelta`. It is
  69. stored in the native ``interval`` data type on PostgreSQL, as a ``INTERVAL
  70. DAY(9) TO SECOND(6)`` on Oracle, and as a ``bigint`` of microseconds on other
  71. backends. Date and time related arithmetic has also been improved on all
  72. backends. There is a corresponding :class:`form field
  73. <django.forms.DurationField>`.
  74. Query Expressions and Database Functions
  75. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  76. :doc:`Query Expressions </ref/models/expressions>` allow users to create,
  77. customize, and compose complex SQL expressions. This has enabled annotate
  78. to accept expressions other than aggregates. Aggregates are now able to
  79. reference multiple fields, as well as perform arithmetic, similar to ``F()``
  80. objects.
  81. A collection of :doc:`database functions </ref/models/database-functions>` is
  82. also included with functionality such as
  83. :class:`~django.db.models.functions.Coalesce`,
  84. :class:`~django.db.models.functions.Concat`, and
  85. :class:`~django.db.models.functions.Substr`.
  86. ``TestCase`` data setup
  87. ~~~~~~~~~~~~~~~~~~~~~~~
  88. :class:`~django.test.TestCase` has been refactored to allow for data
  89. initialization at the class level using transactions and savepoints. Database
  90. backends which do not support transactions, like MySQL with the MyISAM storage
  91. engine, will still be able to run these tests but won't benefit from the
  92. improvements. Tests are now run within two nested
  93. :func:`~django.db.transaction.atomic()` blocks: one for the whole class and one
  94. for each test.
  95. * The class method
  96. :meth:`TestCase.setUpTestData() <django.test.TestCase.setUpTestData>` adds
  97. the ability to setup test data at the class level. Using this technique can
  98. speed up the tests as compared to using ``setUp()``.
  99. * Fixture loading within ``TestCase`` is now performed once for the whole
  100. ``TestCase``.
  101. Minor features
  102. ~~~~~~~~~~~~~~
  103. :mod:`django.contrib.admin`
  104. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  105. * :class:`~django.contrib.admin.ModelAdmin` now has a
  106. :meth:`~django.contrib.admin.ModelAdmin.has_module_permission`
  107. method to allow limiting access to the module on the admin index page.
  108. * :class:`~django.contrib.admin.InlineModelAdmin` now has an attribute
  109. :attr:`~django.contrib.admin.InlineModelAdmin.show_change_link` that
  110. supports showing a link to an inline object's change form.
  111. * Use the new ``django.contrib.admin.RelatedOnlyFieldListFilter`` in
  112. :attr:`ModelAdmin.list_filter <django.contrib.admin.ModelAdmin.list_filter>`
  113. to limit the ``list_filter`` choices to foreign objects which are attached to
  114. those from the ``ModelAdmin``.
  115. * The :meth:`ModelAdmin.delete_view()
  116. <django.contrib.admin.ModelAdmin.delete_view>` displays a summary of objects
  117. to be deleted on the deletion confirmation page.
  118. * The jQuery library embedded in the admin has been upgraded to version 1.11.2.
  119. * You can now specify :attr:`AdminSite.site_url
  120. <django.contrib.admin.AdminSite.site_url>` in order to display a link to the
  121. front-end site.
  122. * You can now specify :attr:`ModelAdmin.show_full_result_count
  123. <django.contrib.admin.ModelAdmin.show_full_result_count>` to control whether
  124. or not the full count of objects should be displayed on a filtered admin page.
  125. * The ``AdminSite.password_change()`` method now has an ``extra_context``
  126. parameter.
  127. * You can now control who may login to the admin site by overriding only
  128. :meth:`AdminSite.has_permission()
  129. <django.contrib.admin.AdminSite.has_permission>` and
  130. :attr:`AdminSite.login_form <django.contrib.admin.AdminSite.login_form>`.
  131. The ``base.html`` template has a new block ``usertools`` which contains the
  132. user-specific header. A new context variable ``has_permission``, which gets
  133. its value from :meth:`~django.contrib.admin.AdminSite.has_permission`,
  134. indicates whether the user may access the site.
  135. * Foreign key dropdowns now have buttons for changing or deleting related
  136. objects using a popup.
  137. :mod:`django.contrib.admindocs`
  138. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  139. * reStructuredText is now parsed in model docstrings.
  140. :mod:`django.contrib.auth`
  141. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  142. * Authorization backends can now raise
  143. :class:`~django.core.exceptions.PermissionDenied` in
  144. :meth:`~django.contrib.auth.models.User.has_perm`
  145. and :meth:`~django.contrib.auth.models.User.has_module_perms`
  146. to short-circuit permission checking.
  147. * :class:`~django.contrib.auth.forms.PasswordResetForm` now
  148. has a method :meth:`~django.contrib.auth.forms.PasswordResetForm.send_email`
  149. that can be overridden to customize the mail to be sent.
  150. * The ``max_length`` of :attr:`Permission.name
  151. <django.contrib.auth.models.Permission.name>` has been increased from 50 to
  152. 255 characters. Please run the database migration.
  153. * :attr:`~django.contrib.auth.models.CustomUser.USERNAME_FIELD` and
  154. :attr:`~django.contrib.auth.models.CustomUser.REQUIRED_FIELDS` now supports
  155. :class:`~django.db.models.ForeignKey`\s.
  156. * The default iteration count for the PBKDF2 password hasher has been
  157. increased by 33%. This backwards compatible change will not affect users who
  158. have subclassed ``django.contrib.auth.hashers.PBKDF2PasswordHasher`` to
  159. change the default value.
  160. :mod:`django.contrib.gis`
  161. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  162. * A new :doc:`GeoJSON serializer </ref/contrib/gis/serializers>` is now
  163. available.
  164. * The Spatialite backend now supports ``Collect`` and ``Extent`` aggregates
  165. when the database version is 3.0 or later.
  166. * The PostGIS 2 ``CREATE EXTENSION postgis`` and the Spatialite
  167. ``SELECT InitSpatialMetaData`` initialization commands are now automatically
  168. run by :djadmin:`migrate`.
  169. * The GDAL interface now supports retrieving properties of
  170. :ref:`raster (image) data file <raster-data-source-objects>`.
  171. * Compatibility shims for ``SpatialRefSys`` and ``GeometryColumns`` changed in
  172. Django 1.2 have been removed.
  173. * All GDAL-related exceptions are now raised with ``GDALException``. The former
  174. ``OGRException`` has been kept for backwards compatibility but should not be
  175. used any longer.
  176. :mod:`django.contrib.messages`
  177. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  178. * ...
  179. :mod:`django.contrib.redirects`
  180. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  181. * ...
  182. :mod:`django.contrib.sessions`
  183. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  184. * Session cookie is now deleted after
  185. :meth:`~django.contrib.sessions.backends.base.SessionBase.flush()` is called.
  186. :mod:`django.contrib.sitemaps`
  187. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  188. * The new :attr:`Sitemap.i18n <django.contrib.sitemaps.Sitemap.i18n>` attribute
  189. allows you to generate a sitemap based on the :setting:`LANGUAGES` setting.
  190. :mod:`django.contrib.sites`
  191. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  192. * :func:`~django.contrib.sites.shortcuts.get_current_site` will now lookup
  193. the current site based on :meth:`request.get_host()
  194. <django.http.HttpRequest.get_host>` if the :setting:`SITE_ID` setting is not
  195. defined.
  196. * The default :class:`~django.contrib.sites.models.Site` created when running
  197. ``migrate`` now respects the :setting:`SITE_ID` setting (instead of always
  198. using ``pk=1``).
  199. :mod:`django.contrib.staticfiles`
  200. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  201. * ...
  202. :mod:`django.contrib.syndication`
  203. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  204. * ...
  205. Cache
  206. ^^^^^
  207. * The ``incr()`` method of the
  208. ``django.core.cache.backends.locmem.LocMemCache`` backend is now thread-safe.
  209. Cryptography
  210. ^^^^^^^^^^^^
  211. * The ``max_age`` parameter of the
  212. :meth:`django.core.signing.TimestampSigner.unsign` method now also accept a
  213. :py:class:`datetime.timedelta` object.
  214. Database backends
  215. ^^^^^^^^^^^^^^^^^
  216. * The MySQL backend no longer strips microseconds from ``datetime`` values as
  217. MySQL 5.6.4 and up supports fractional seconds depending on the declaration
  218. of the datetime field (when ``DATETIME`` includes fractional precision greater
  219. than 0). New datetime database columns created with Django 1.8 and MySQL 5.6.4
  220. and up will support microseconds. See the :ref:`MySQL database notes
  221. <mysql-fractional-seconds>` for more details.
  222. * The MySQL backend no longer creates explicit indexes for foreign keys when
  223. using the InnoDB storage engine, as MySQL already creates them automatically.
  224. Email
  225. ^^^^^
  226. * :ref:`Email backends <topic-email-backends>` now support the context manager
  227. protocol for opening and closing connections.
  228. * The SMTP email backend now supports ``keyfile`` and ``certfile``
  229. authentication with the :setting:`EMAIL_SSL_CERTFILE` and
  230. :setting:`EMAIL_SSL_KEYFILE` settings.
  231. * The SMTP :class:`~django.core.mail.backends.smtp.EmailBackend` now supports
  232. setting the ``timeout`` parameter with the :setting:`EMAIL_TIMEOUT` setting.
  233. * :class:`~django.core.mail.EmailMessage` and ``EmailMultiAlternatives`` now
  234. support the ``reply_to`` parameter.
  235. File Storage
  236. ^^^^^^^^^^^^
  237. * ...
  238. File Uploads
  239. ^^^^^^^^^^^^
  240. * ...
  241. Forms
  242. ^^^^^
  243. * Form widgets now render attributes with a value of ``True`` or ``False``
  244. as HTML5 boolean attributes.
  245. * The new :meth:`~django.forms.Form.has_error()` method allows checking
  246. if a specific error has happened.
  247. * If :attr:`~django.forms.Form.required_css_class` is defined on a form, then
  248. the ``<label>`` tags for required fields will have this class present in its
  249. attributes.
  250. * The rendering of non-field errors in unordered lists (``<ul>``) now includes
  251. ``nonfield`` in its list of classes to distinguish them from field-specific
  252. errors.
  253. * :class:`~django.forms.Field` now accepts a
  254. :attr:`~django.forms.Field.label_suffix` argument, which will override the
  255. form's :attr:`~django.forms.Form.label_suffix`. This enables customizing the
  256. suffix on a per-field basis — previously it wasn't possible to override
  257. a form's :attr:`~django.forms.Form.label_suffix` while using shortcuts such
  258. as ``{{ form.as_p }}`` in templates.
  259. * :class:`~django.forms.extras.widgets.SelectDateWidget` now accepts an
  260. :attr:`~django.forms.extras.widgets.SelectDateWidget.empty_label` argument, which will
  261. override the top list choice label when :class:`~django.forms.DateField` is not required.
  262. * After an :class:`~django.forms.ImageField` has been cleaned and validated, the
  263. ``UploadedFile`` object will have an additional ``image`` attribute containing
  264. the Pillow ``Image`` instance used to check if the file was a valid image. It
  265. will also update ``UploadedFile.content_type`` with the image's content type
  266. as determined by Pillow.
  267. * You can now pass a callable that returns an iterable of choices when
  268. instantiating a :class:`~django.forms.ChoiceField`.
  269. Generic Views
  270. ^^^^^^^^^^^^^
  271. * Generic views that use :class:`~django.views.generic.list.MultipleObjectMixin`
  272. may now specify the ordering applied to the
  273. :attr:`~django.views.generic.list.MultipleObjectMixin.queryset` by setting
  274. :attr:`~django.views.generic.list.MultipleObjectMixin.ordering` or overriding
  275. :meth:`~django.views.generic.list.MultipleObjectMixin.get_ordering()`.
  276. * The new :attr:`SingleObjectMixin.query_pk_and_slug
  277. <django.views.generic.detail.SingleObjectMixin.query_pk_and_slug>`
  278. attribute allows changing the behavior of
  279. :meth:`~django.views.generic.detail.SingleObjectMixin.get_object()`
  280. so that it'll perform its lookup using both the primary key and the slug.
  281. * The :meth:`~django.views.generic.edit.FormMixin.get_form()` method doesn't
  282. require a ``form_class`` to be provided anymore. If not provided ``form_class``
  283. defaults to :meth:`~django.views.generic.edit.FormMixin.get_form_class()`.
  284. Internationalization
  285. ^^^^^^^^^^^^^^^^^^^^
  286. * :setting:`FORMAT_MODULE_PATH` can now be a list of strings representing
  287. module paths. This allows importing several format modules from different
  288. reusable apps. It also allows overriding those custom formats in your main
  289. Django project.
  290. Logging
  291. ^^^^^^^
  292. * The :class:`django.utils.log.AdminEmailHandler` class now has a
  293. :meth:`~django.utils.log.AdminEmailHandler.send_mail` method to make it more
  294. subclass friendly.
  295. Management Commands
  296. ^^^^^^^^^^^^^^^^^^^
  297. * Database connections are now always closed after a management command called
  298. from the command line has finished doing its job.
  299. * Commands from alternate package formats like eggs are now also discovered.
  300. * :djadmin:`dumpdata` now has the option :djadminopt:`--output` which allows
  301. specifying the file to which the serialized data is written.
  302. * :djadmin:`makemessages` and :djadmin:`compilemessages` now have the option
  303. :djadminopt:`--exclude` which allows exclusion of specific locales from
  304. processing.
  305. * :djadmin:`compilemessages` now has a ``--use-fuzzy`` or ``-f`` option which
  306. includes fuzzy translations into compiled files.
  307. * The :djadminopt:`--ignorenonexistent` option of the :djadmin:`loaddata`
  308. management command now ignores data for models that no longer exist.
  309. * :djadmin:`runserver` now uses daemon threads for faster reloading.
  310. * :djadmin:`inspectdb` now outputs ``Meta.unique_together``. It is also able to
  311. introspect :class:`~django.db.models.AutoField` for MySQL and PostgreSQL
  312. databases.
  313. * When calling management commands from code through :ref:`call_command
  314. <call-command>` and passing options, the option name can match the command
  315. line option name (without the initial dashes) or the final option destination
  316. variable name, but in either case, the resulting option received by the
  317. command is now always the ``dest`` name specified in the command option
  318. definition (as long as the command uses the new :py:mod:`argparse` module).
  319. * The :djadmin:`dbshell` command now supports MySQL's optional SSL certificate
  320. authority setting (``--ssl-ca``).
  321. * The :djadminopt:`--name` option for :djadmin:`makemigrations` allows you to
  322. to give the migration(s) a custom name instead of a generated one.
  323. * The :djadmin:`loaddata` command now prevents repeated fixture loading. If
  324. :setting:`FIXTURE_DIRS` contains duplicates or a default fixture directory
  325. path (``app_name/fixtures``), an exception is raised.
  326. * :djadmin:`makemigrations` now supports an :djadminopt:`--exit` option to
  327. exit with an error code if no migrations are created.
  328. * The new :djadmin:`showmigrations` command allows listing all migrations and
  329. their dependencies in a project.
  330. Middleware
  331. ^^^^^^^^^^
  332. * The :attr:`CommonMiddleware.response_redirect_class
  333. <django.middleware.common.CommonMiddleware.response_redirect_class>`
  334. attribute allows you to customize the redirects issued by the middleware.
  335. * A debug message will be logged to the ``django.request`` logger when a
  336. middleware raises a :exc:`~django.core.exceptions.MiddlewareNotUsed` exception
  337. in :setting:`DEBUG` mode.
  338. Migrations
  339. ^^^^^^^^^^
  340. * The :class:`~django.db.migrations.operations.RunSQL` operation can now handle
  341. parameters passed to the SQL statements.
  342. * It is now possible to have migrations (most probably :ref:`data migrations
  343. <data-migrations>`) for applications without models.
  344. * Migrations can now :ref:`serialize model managers
  345. <using-managers-in-migrations>` as part of the model state.
  346. * A :ref:`generic mechanism to handle the deprecation of model fields
  347. <migrations-removing-model-fields>` was added.
  348. * The :attr:`RunPython.noop <django.db.migrations.operations.RunPython.noop>`
  349. and :meth:`RunSQL.noop() <django.db.migrations.operations.RunSQL.noop>` class
  350. attribute/method were added to ease in making ``RunPython`` and ``RunSQL``
  351. operations reversible.
  352. * The :class:`~django.db.migrations.operations.RunPython` and
  353. :class:`~django.db.migrations.operations.RunSQL` operations now accept a
  354. ``hints`` parameter that will be passed to :meth:`allow_migrate`. To take
  355. advantage of this feature you must ensure that the ``allow_migrate()`` method
  356. of all your routers accept ``**hints``.
  357. Models
  358. ^^^^^^
  359. * Django now logs at most 9000 queries in ``connections.queries``, in order
  360. to prevent excessive memory usage in long-running processes in debug mode.
  361. * There is now a model ``Meta`` option to define a
  362. :attr:`default related name <django.db.models.Options.default_related_name>`
  363. for all relational fields of a model.
  364. * Pickling models and querysets across different versions of Django isn't
  365. officially supported (it may work, but there's no guarantee). An extra
  366. variable that specifies the current Django version is now added to the
  367. pickled state of models and querysets, and Django raises a ``RuntimeWarning``
  368. when these objects are unpickled in a different version than the one in
  369. which they were pickled.
  370. * Added :meth:`Model.from_db() <django.db.models.Model.from_db()>` which
  371. Django uses whenever objects are loaded using the ORM. The method allows
  372. customizing model loading behavior.
  373. * ``extra(select={...})`` now allows you to escape a literal ``%s`` sequence
  374. using ``%%s``.
  375. * :doc:`Custom Lookups</howto/custom-lookups>` can now be registered using
  376. a decorator pattern.
  377. * The new :attr:`Transform.bilateral <django.db.models.Transform.bilateral>`
  378. attribute allows creating bilateral transformations. These transformations
  379. are applied to both ``lhs`` and ``rhs`` when used in a lookup expression,
  380. providing opportunities for more sophisticated lookups.
  381. * SQL special characters (\, %, _) are now escaped properly when a pattern
  382. lookup (e.g. ``contains``, ``startswith``, etc.) is used with an ``F()``
  383. expression as the right-hand side. In those cases, the escaping is performed
  384. by the database, which can lead to somewhat complex queries involving nested
  385. ``REPLACE`` function calls.
  386. * You can now refresh model instances by using :meth:`Model.refresh_from_db()
  387. <django.db.models.Model.refresh_from_db>`.
  388. * You can now get the set of deferred fields for a model using
  389. :meth:`Model.get_deferred_fields() <django.db.models.Model.get_deferred_fields>`.
  390. Signals
  391. ^^^^^^^
  392. * Exceptions from the ``(receiver, exception)`` tuples returned by
  393. :meth:`Signal.send_robust() <django.dispatch.Signal.send_robust>` now have
  394. their traceback attached as a ``__traceback__`` attribute.
  395. * The ``environ`` argument, which contains the WSGI environment structure from
  396. the request, was added to the :data:`~django.core.signals.request_started`
  397. signal.
  398. * You can now import the :func:`~django.test.signals.setting_changed` signal
  399. from ``django.core.signals`` to avoid loading ``django.test`` in non-test
  400. situations. Django no longer does so itself.
  401. System Check Framework
  402. ^^^^^^^^^^^^^^^^^^^^^^
  403. * :attr:`~django.core.checks.register` can now be used as a function.
  404. Templates
  405. ^^^^^^^^^
  406. * :tfilter:`urlize` now supports domain-only links that include characters after
  407. the top-level domain (e.g. ``djangoproject.com/`` and
  408. ``djangoproject.com/download/``).
  409. * :tfilter:`urlize` doesn't treat exclamation marks at the end of a domain or
  410. its query string as part of the URL (the URL in e.g. ``'djangoproject.com!``
  411. is ``djangoproject.com``)
  412. * Added a :class:`locmem.Loader <django.template.loaders.locmem.Loader>`
  413. class that loads Django templates from a Python dictionary.
  414. * The :ttag:`now` tag can now store its output in a context variable with the
  415. usual syntax: ``{% now 'j n Y' as varname %}``.
  416. Requests and Responses
  417. ^^^^^^^^^^^^^^^^^^^^^^
  418. * ``WSGIRequest`` now respects paths starting with ``//``.
  419. * The :meth:`HttpRequest.build_absolute_uri()
  420. <django.http.HttpRequest.build_absolute_uri>` method now handles paths
  421. starting with ``//`` correctly.
  422. * If :setting:`DEBUG` is ``True`` and a request raises a
  423. :exc:`~django.core.exceptions.SuspiciousOperation`, the response will be
  424. rendered with a detailed error page.
  425. * The ``query_string`` argument of :class:`~django.http.QueryDict` is now
  426. optional, defaulting to ``None``, so a blank ``QueryDict`` can now be
  427. instantiated with ``QueryDict()`` instead of ``QueryDict(None)`` or
  428. ``QueryDict('')``.
  429. * The ``GET`` and ``POST`` attributes of an :class:`~django.http.HttpRequest`
  430. object are now :class:`~django.http.QueryDict`\s rather than dictionaries,
  431. and the ``FILES`` attribute is now a ``MultiValueDict``.
  432. This brings this class into line with the documentation and with
  433. ``WSGIRequest``.
  434. * The :attr:`HttpResponse.charset <django.http.HttpResponse.charset>` attribute
  435. was added.
  436. * ``WSGIRequestHandler`` now follows RFC in converting URI to IRI, using
  437. ``uri_to_iri()``.
  438. * The :meth:`HttpRequest.get_full_path()
  439. <django.http.HttpRequest.get_full_path>` method now escapes unsafe characters
  440. from the path portion of a Uniform Resource Identifier (URI) properly.
  441. * :class:`~django.http.HttpResponse` now implements a few additional methods
  442. like :meth:`~django.http.HttpResponse.getvalue` so that instances can be used
  443. as stream objects.
  444. * The new :meth:`HttpResponse.setdefault()
  445. <django.http.HttpResponse.setdefault>` method allows setting a header unless
  446. it has already been set.
  447. * You can use the new :class:`~django.http.FileResponse` to stream files.
  448. * The :func:`~django.views.decorators.http.condition` decorator for
  449. conditional view processing now supports the ``If-unmodified-since`` header.
  450. Tests
  451. ^^^^^
  452. * The :class:`RequestFactory.trace() <django.test.RequestFactory>`
  453. and :class:`Client.trace() <django.test.Client.trace>` methods were
  454. implemented, allowing you to create ``TRACE`` requests in your tests.
  455. * The ``count`` argument was added to
  456. :meth:`~django.test.SimpleTestCase.assertTemplateUsed`. This allows you to
  457. assert that a template was rendered a specific number of times.
  458. * The new :meth:`~django.test.SimpleTestCase.assertJSONNotEqual` assertion
  459. allows you to test that two JSON fragments are not equal.
  460. * Added options to the :djadmin:`test` command to preserve the test database
  461. (:djadminopt:`--keepdb`), to run the test cases in reverse order
  462. (:djadminopt:`--reverse`), and to enable SQL logging for failing tests
  463. (:djadminopt:`--debug-sql`).
  464. * Added the :attr:`~django.test.Response.resolver_match` attribute to test
  465. client responses.
  466. * Added several settings that allow customization of test tablespace parameters
  467. for Oracle: :setting:`DATAFILE`, :setting:`DATAFILE_TMP`,
  468. :setting:`DATAFILE_MAXSIZE` and :setting:`DATAFILE_TMP_MAXSIZE`.
  469. * The :func:`~django.test.override_settings` decorator can now affect the
  470. master router in :setting:`DATABASE_ROUTERS`.
  471. * Added test client support for file uploads with file-like objects.
  472. * A shared cache is now used when testing with a SQLite in-memory database when
  473. using Python 3.4+ and SQLite 3.7.13+. This allows sharing the database
  474. between threads.
  475. Validators
  476. ^^^^^^^^^^
  477. * :class:`~django.core.validators.URLValidator` now supports IPv6 addresses,
  478. unicode domains, and URLs containing authentication data.
  479. Backwards incompatible changes in 1.8
  480. =====================================
  481. .. warning::
  482. In addition to the changes outlined in this section, be sure to review the
  483. :ref:`deprecation plan <deprecation-removed-in-1.8>` for any features that
  484. have been removed. If you haven't updated your code within the
  485. deprecation timeline for a given feature, its removal may appear as a
  486. backwards incompatible change.
  487. Related object operations are run in a transaction
  488. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  489. Some operations on related objects such as
  490. :meth:`~django.db.models.fields.related.RelatedManager.add()` or
  491. :ref:`direct assignment<direct-assignment>` ran multiple data modifying
  492. queries without wrapping them in transactions. To reduce the risk of data
  493. corruption, all data modifying methods that affect multiple related objects
  494. (i.e. ``add()``, ``remove()``, ``clear()``, and :ref:`direct assignment
  495. <direct-assignment>`) now perform their data modifying queries from within a
  496. transaction, provided your database supports transactions.
  497. This has one backwards incompatible side effect, signal handlers triggered from
  498. these methods are now executed within the method's transaction and any
  499. exception in a signal handler will prevent the whole operation.
  500. Assigning unsaved objects to relations raises an error
  501. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  502. Assigning unsaved objects to a :class:`~django.db.models.ForeignKey`,
  503. :class:`~django.contrib.contenttypes.fields.GenericForeignKey`, and
  504. :class:`~django.db.models.OneToOneField` now raises a :exc:`ValueError`.
  505. Previously, the assignment of an unsaved object would be silently ignored.
  506. For example::
  507. >>> book = Book.objects.create(name="Django")
  508. >>> book.author = Author(name="John")
  509. >>> book.author.save()
  510. >>> book.save()
  511. >>> Book.objects.get(name="Django")
  512. >>> book.author
  513. >>>
  514. Now, an error will be raised to prevent data loss::
  515. >>> book.author = Author(name="john")
  516. Traceback (most recent call last):
  517. ...
  518. ValueError: Cannot assign "<Author: John>": "Author" instance isn't saved in the database.
  519. Management commands that only accept positional arguments
  520. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  521. If you have written a custom management command that only accepts positional
  522. arguments and you didn't specify the
  523. :attr:`~django.core.management.BaseCommand.args` command variable, you might
  524. get an error like ``Error: unrecognized arguments: ...``, as variable parsing
  525. is now based on :py:mod:`argparse` which doesn't implicitly accept positional
  526. arguments. You can make your command backwards compatible by simply setting the
  527. :attr:`~django.core.management.BaseCommand.args` class variable. However, if
  528. you don't have to keep compatibility with older Django versions, it's better to
  529. implement the new :meth:`~django.core.management.BaseCommand.add_arguments`
  530. method as described in :doc:`/howto/custom-management-commands`.
  531. Custom test management command arguments through test runner
  532. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  533. The method to add custom arguments to the `test` management command through the
  534. test runner has changed. Previously, you could provide an `option_list` class
  535. variable on the test runner to add more arguments (à la :py:mod:`optparse`).
  536. Now to implement the same behavior, you have to create an
  537. ``add_arguments(cls, parser)`` class method on the test runner and call
  538. ``parser.add_argument`` to add any custom arguments, as parser is now an
  539. :py:class:`argparse.ArgumentParser` instance.
  540. Model check ensures auto-generated column names are within limits specified by database
  541. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  542. A field name that's longer than the column name length supported by a database
  543. can create problems. For example, with MySQL you'll get an exception trying to
  544. create the column, and with PostgreSQL the column name is truncated by the
  545. database (you may see a warning in the PostgreSQL logs).
  546. A model check has been introduced to better alert users to this scenario before
  547. the actual creation of database tables.
  548. If you have an existing model where this check seems to be a false positive,
  549. for example on PostgreSQL where the name was already being truncated, simply
  550. use :attr:`~django.db.models.Field.db_column` to specify the name that's being
  551. used.
  552. The check also applies to the columns generated in an implicit
  553. ``ManyToManyField.through`` model. If you run into an issue there, use
  554. :attr:`~django.db.models.ManyToManyField.through` to create an explicit model
  555. and then specify :attr:`~django.db.models.Field.db_column` on its column(s)
  556. as needed.
  557. Query relation lookups now check object types
  558. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  559. Querying for model lookups now checks if the object passed is of correct type
  560. and raises a :exc:`ValueError` if not. Previously, Django didn't care if the
  561. object was of correct type; it just used the object's related field attribute
  562. (e.g. ``id``) for the lookup. Now, an error is raised to prevent incorrect
  563. lookups::
  564. >>> book = Book.objects.create(name="Django")
  565. >>> book = Book.objects.filter(author=book)
  566. Traceback (most recent call last):
  567. ...
  568. ValueError: Cannot query "<Book: Django>": Must be "Author" instance.
  569. ``select_related()`` now checks given fields
  570. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  571. ``select_related()`` now validates that the given fields actually exist.
  572. Previously, nonexistent fields were silently ignored. Now, an error is raised::
  573. >>> book = Book.objects.select_related('nonexistent_field')
  574. Traceback (most recent call last):
  575. ...
  576. FieldError: Invalid field name(s) given in select_related: 'nonexistent_field'
  577. The validation also makes sure that the given field is relational::
  578. >>> book = Book.objects.select_related('name')
  579. Traceback (most recent call last):
  580. ...
  581. FieldError: Non-relational field given in select_related: 'name'
  582. Default ``EmailField.max_length`` increased to 254
  583. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  584. The old default 75 character ``max_length`` was not capable of storing all
  585. possible RFC3696/5321-compliant email addresses. In order to store all
  586. possible valid email addresses, the ``max_length`` has been increased to 254
  587. characters. You will need to generate and apply database migrations for your
  588. affected models (or add ``max_length=75`` if you wish to keep the length on
  589. your current fields). A migration for
  590. :attr:`django.contrib.auth.models.User.email` is included.
  591. Support for PostgreSQL versions older than 9.0
  592. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  593. The end of upstream support periods was reached in July 2014 for PostgreSQL 8.4.
  594. As a consequence, Django 1.8 sets 9.0 as the minimum PostgreSQL version it
  595. officially supports.
  596. This also includes dropping support for PostGIS 1.3 and 1.4 as these versions
  597. are not supported on versions of PostgreSQL later than 8.4.
  598. Django also now requires the use of Psycopg2 version 2.0.9 or higher.
  599. Support for MySQL versions older than 5.5
  600. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  601. The end of upstream support periods was reached in January 2012 for MySQL 5.0
  602. and December 2013 for MySQL 5.1. As a consequence, Django 1.8 sets 5.5 as the
  603. minimum MySQL version it officially supports.
  604. Support for Oracle versions older than 11.1
  605. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  606. The end of upstream support periods was reached in July 2010 for Oracle 9.2,
  607. January 2012 for Oracle 10.1, and July 2013 for Oracle 10.2. As a consequence,
  608. Django 1.8 sets 11.1 as the minimum Oracle version it officially supports.
  609. Specific privileges used instead of roles for tests on Oracle
  610. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  611. Earlier versions of Django granted the CONNECT and RESOURCE roles to the test
  612. user on Oracle. These roles have been deprecated, so Django 1.8 uses the
  613. specific underlying privileges instead. This changes the privileges required
  614. of the main user for running tests (unless the project is configured to avoid
  615. creating a test user). The exact privileges required now are detailed in
  616. :ref:`Oracle notes <oracle-notes>`.
  617. ``AbstractUser.last_login`` allows null values
  618. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  619. The :attr:`AbstractUser.last_login <django.contrib.auth.models.User.last_login>`
  620. field now allows null values. Previously, it defaulted to the time when the user
  621. was created which was misleading if the user never logged in. Please run the
  622. database migration. If your custom user inherits from ``AbstractUser`` and you
  623. wish to set ``last_login`` to ``NULL`` for users who haven't logged in, you can
  624. run this query::
  625. from django.db import models
  626. from django.contrib.auth import get_user_model
  627. from django.contrib.auth.models import AbstractBaseUser
  628. UserModel = get_user_model()
  629. if issubclass(UserModel, AbstractBaseUser):
  630. UserModel._default_manager.filter(
  631. last_login=models.F('date_joined')
  632. ).update(last_login=None)
  633. :mod:`django.contrib.gis`
  634. ~~~~~~~~~~~~~~~~~~~~~~~~~
  635. * Support for GEOS 3.1 and GDAL 1.6 has been dropped.
  636. * Support for SpatiaLite < 2.4 has been dropped.
  637. * GIS-specific lookups have been refactored to use the
  638. :class:`django.db.models.Lookup` API.
  639. * The default ``str`` representation of
  640. :class:`~django.contrib.gis.geos.GEOSGeometry` objects has been changed from
  641. WKT to EWKT format (including the SRID). As this representation is used in
  642. the serialization framework, that means that ``dumpdata`` output will now
  643. contain the SRID value of geometry objects.
  644. Priority of context processors for ``TemplateResponse`` brought in line with ``render``
  645. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  646. The :class:`~django.template.response.TemplateResponse` constructor is designed to be a
  647. drop-in replacement for the :func:`~django.shortcuts.render` function. However,
  648. it had a slight incompatibility, in that for ``TemplateResponse``, context data
  649. from the passed in context dictionary could be shadowed by context data returned
  650. from context processors, whereas for ``render`` it was the other way
  651. around. This was a bug, and the behavior of ``render`` is more appropriate,
  652. since it allows the globally defined context processors to be overridden locally
  653. in the view. If you were relying on the fact context data in a
  654. ``TemplateResponse`` could be overridden using a context processor, you will
  655. need to change your code.
  656. Overriding ``setUpClass`` / ``tearDownClass`` in test cases
  657. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  658. The decorators :func:`~django.test.override_settings` and
  659. :func:`~django.test.modify_settings` now act at the class level when used as
  660. class decorators. As a consequence, when overriding ``setUpClass()`` or
  661. ``tearDownClass()``, the ``super`` implementation should always be called.
  662. Removal of ``django.contrib.formtools``
  663. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  664. The formtools contrib app has been moved into a separate package.
  665. ``django.contrib.formtools`` itself has been removed. The docs provide
  666. :ref:`migration instructions <formtools-how-to-migrate>`.
  667. The new package is available `on Github`_ and on PyPI.
  668. .. _on GitHub: https://github.com/django/django-formtools/
  669. Database connection reloading between tests
  670. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  671. Django previously closed database connections between each test within a
  672. ``TestCase``. This is no longer the case as Django now wraps the whole
  673. ``TestCase`` within a transaction. If some of your tests relied on the old
  674. behavior, you should have them inherit from ``TransactionTestCase`` instead.
  675. Cleanup of the ``django.template`` namespace
  676. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  677. If you've been relying on private APIs exposed in the ``django.template``
  678. module, you may have to import them from ``django.template.base`` instead.
  679. Also private APIs ``django.template.base.compile_string()``,
  680. ``django.template.loader.find_template()``, and
  681. ``django.template.loader.get_template_from_string()`` were removed.
  682. Database backend API
  683. ~~~~~~~~~~~~~~~~~~~~
  684. The following changes to the database backend API are documented to assist
  685. those writing third-party backends in updating their code:
  686. * The ``data_types``, ``data_types_suffix``, and
  687. ``data_type_check_constraints`` attributes have moved from the
  688. ``DatabaseCreation`` class to ``DatabaseWrapper``.
  689. :mod:`django.contrib.admin`
  690. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  691. * ``AdminSite`` no longer takes an ``app_name`` argument and its ``app_name``
  692. attribute has been removed. The application name is always ``admin`` (as
  693. opposed to the instance name which you can still customize using
  694. ``AdminSite(name="...")``.
  695. * The ``ModelAdmin.get_object()`` method (private API) now takes a third
  696. argument named ``from_field`` in order to specify which field should match
  697. the provided ``object_id``.
  698. * The :meth:`ModelAdmin.response_delete()
  699. <django.contrib.admin.ModelAdmin.response_delete>` method
  700. now takes a second argument named ``obj_id`` which is the serialized
  701. identifier used to retrieve the object before deletion.
  702. Miscellaneous
  703. ~~~~~~~~~~~~~
  704. * ``connections.queries`` is now a read-only attribute.
  705. * Database connections are considered equal only if they're the same object.
  706. They aren't hashable any more.
  707. * :class:`~django.middleware.gzip.GZipMiddleware` used to disable compression
  708. for some content types when the request is from Internet Explorer, in order
  709. to work around a bug in IE6 and earlier. This behavior could affect
  710. performance on IE7 and later. It was removed.
  711. * ``URLField.to_python`` no longer adds a trailing slash to pathless URLs.
  712. * The :tfilter:`length` template filter now returns ``0`` for an undefined
  713. variable, rather than an empty string.
  714. * ``ForeignKey.default_error_message['invalid']`` has been changed from
  715. ``'%(model)s instance with pk %(pk)r does not exist.'`` to
  716. ``'%(model)s instance with %(field)s %(value)r does not exist.'`` If you are
  717. using this message in your own code, please update the list of interpolated
  718. parameters. Internally, Django will continue to provide the
  719. ``pk`` parameter in ``params`` for backwards compatibility.
  720. * ``UserCreationForm.errors_messages['duplicate_username']`` is no longer used.
  721. If you wish to customize that error message, :ref:`override it on the form
  722. <modelforms-overriding-default-fields>` using the ``'unique'`` key in
  723. ``Meta.errors_messages['username']`` or, if you have a custom form field for
  724. ``'username'``, using the the ``'unique'`` key in its
  725. :attr:`~django.forms.Field.error_messages` argument.
  726. * The block ``usertools`` in the ``base.html`` template of
  727. :mod:`django.contrib.admin` now requires the ``has_permission`` context
  728. variable to be set. If you have any custom admin views that use this
  729. template, update them to pass :meth:`AdminSite.has_permission()
  730. <django.contrib.admin.AdminSite.has_permission>` as this new variable's
  731. value or simply include :meth:`AdminSite.each_context(request)
  732. <django.contrib.admin.AdminSite.each_context>` in the context.
  733. * Internal changes were made to the :class:`~django.forms.ClearableFileInput`
  734. widget to allow more customization. The undocumented ``url_markup_template``
  735. attribute was removed in favor of ``template_with_initial``.
  736. * For consistency with other major vendors, the ``en_GB`` locale now has Monday
  737. as the first day of the week.
  738. * Seconds have been removed from any locales that had them in ``TIME_FORMAT``,
  739. ``DATETIME_FORMAT``, or ``SHORT_DATETIME_FORMAT``.
  740. * The default max size of the Oracle test tablespace has increased from 300M
  741. (or 200M, before 1.7.2) to 500M.
  742. * :func:`~django.core.urlresolvers.reverse` and
  743. :func:`~django.core.urlresolvers.reverse_lazy` now return Unicode strings
  744. instead of byte strings.
  745. * The ``CacheClass`` shim has been removed from all cache backends.
  746. These aliases were provided for backwards compatibility with Django 1.3.
  747. If you are still using them, please update your project to use the real
  748. class name found in the :setting:`BACKEND <CACHES-BACKEND>` key of the
  749. :setting:`CACHES` setting.
  750. * By default, :ref:`call_command <call-command>` now always skips the check
  751. framework (unless you pass it ``skip_checks=False``).
  752. * When iterating over lines, :class:`~django.core.files.File` now uses
  753. `universal newlines`_. The following are recognized as ending a line: the
  754. Unix end-of-line convention ``'\n'``, the Windows convention ``'\r\n'``, and
  755. the old Macintosh convention ``'\r'``.
  756. .. _universal newlines: https://www.python.org/dev/peps/pep-0278
  757. * The Memcached cache backends ``MemcachedCache`` and ``PyLibMCCache`` will
  758. delete a key if ``set()`` fails. This is necessary to ensure the ``cache_db``
  759. session store always fetches the most current session data.
  760. * Private APIs ``override_template_loaders`` and ``override_with_test_loader``
  761. in ``django.test.utils`` were removed. Override ``TEMPLATES`` with
  762. ``override_settings`` instead.
  763. * Warnings from the MySQL database backend are no longer converted to
  764. exceptions when :setting:`DEBUG` is ``True``.
  765. * :class:`~django.http.HttpRequest` now has a simplified ``repr`` (e.g.
  766. ``<WSGIRequest: GET '/somepath/'>``). This won't change the behavior of
  767. the :class:`~django.views.debug.SafeExceptionReporterFilter` class.
  768. * Class-based views that use :class:`~django.views.generic.edit.ModelFormMixin`
  769. will raise an :exc:`~django.core.exceptions.ImproperlyConfigured` exception
  770. when both the ``fields`` and ``form_class`` attributes are specified.
  771. Previously, ``fields`` was silently ignored.
  772. * When following redirects, the test client now raises
  773. :exc:`~django.test.client.RedirectCycleError` if it detects a loop or hits a
  774. maximum redirect limit (rather than passing silently).
  775. * Translatable strings set as the ``default`` parameter of the field are cast
  776. to concrete strings later, so the return type of ``Field.get_default()`` is
  777. different in some cases. There is no change to default values which are the
  778. result of a callable.
  779. * ``GenericIPAddressField.empty_strings_allowed`` is now ``False``. Database
  780. backends that interpret empty strings as null (only Oracle among the backends
  781. that Django includes) will no longer convert null values back to an empty
  782. string. This is consistent with other backends.
  783. * When the :attr:`~django.core.management.BaseCommand.leave_locale_alone`
  784. attribute is ``False``, translations are now deactivated instead of forcing
  785. the "en-us" locale. In the case your models contained non-English strings and
  786. you counted on English translations to be activated in management commands,
  787. this will not happen any longer. It might be that new database migrations are
  788. generated (once) after migrating to 1.8.
  789. * :func:`django.utils.translation.get_language()` now returns ``None`` instead
  790. of :setting:`LANGUAGE_CODE` when translations are temporarily deactivated.
  791. * The migration operations :class:`~django.db.migrations.operations.RunPython`
  792. and :class:`~django.db.migrations.operations.RunSQL` now call the
  793. :meth:`allow_migrate` method of database routers. In these cases the
  794. ``model`` argument of ``allow_migrate()`` is set to ``None``, so the router
  795. must properly handle this value. This is most useful when used together with
  796. the newly introduced ``hints`` parameter for these operations, but it can
  797. also be used to disable migrations from running on a particular database.
  798. .. _deprecated-features-1.8:
  799. Features deprecated in 1.8
  800. ==========================
  801. Selected methods in ``django.db.models.options.Options``
  802. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  803. As part of the formalization of the ``Model._meta`` API (from the
  804. :class:`django.db.models.options.Options` class), a number of methods have been
  805. deprecated and will be removed in Django 2.0:
  806. * ``get_all_field_names()``
  807. * ``get_all_related_objects()``
  808. * ``get_all_related_objects_with_model()``
  809. * ``get_all_related_many_to_many_objects()``
  810. * ``get_all_related_m2m_objects_with_model()``
  811. * ``get_concrete_fields_with_model()``
  812. * ``get_field_by_name()``
  813. * ``get_fields_with_model()``
  814. * ``get_m2m_with_model()``
  815. A :ref:`migration guide <migrating-old-meta-api>` has been provided to assist
  816. in converting your code from the old API to the new, official API.
  817. Loading ``cycle`` and ``firstof`` template tags from ``future`` library
  818. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  819. Django 1.6 introduced ``{% load cycle from future %}`` and
  820. ``{% load firstof from future %}`` syntax for forward compatibility of the
  821. :ttag:`cycle` and :ttag:`firstof` template tags. This syntax is now deprecated
  822. and will be removed in Django 2.0. You can simply remove the
  823. ``{% load ... from future %}`` tags.
  824. ``django.conf.urls.patterns()``
  825. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  826. In the olden days of Django, it was encouraged to reference views as strings
  827. in ``urlpatterns``::
  828. urlpatterns = patterns('',
  829. url('^$', 'myapp.views.myview'),
  830. )
  831. and Django would magically import ``myapp.views.myview`` internally and turn
  832. the string into a real function reference. In order to reduce repetition when
  833. referencing many views from the same module, the ``patterns()`` function takes
  834. a required initial ``prefix`` argument which is prepended to all
  835. views-as-strings in that set of ``urlpatterns``::
  836. urlpatterns = patterns('myapp.views',
  837. url('^$', 'myview'),
  838. url('^other/$', 'otherview'),
  839. )
  840. In the modern era, we have updated the tutorial to instead recommend importing
  841. your views module and referencing your view functions (or classes) directly.
  842. This has a number of advantages, all deriving from the fact that we are using
  843. normal Python in place of "Django String Magic": the errors when you mistype a
  844. view name are less obscure, IDEs can help with autocompletion of view names,
  845. etc.
  846. So these days, the above use of the ``prefix`` arg is much more likely to be
  847. written (and is better written) as::
  848. from myapp import views
  849. urlpatterns = patterns('',
  850. url('^$', views.myview),
  851. url('^other/$', views.otherview),
  852. )
  853. Thus ``patterns()`` serves little purpose and is a burden when teaching new users
  854. (answering the newbie's question "why do I need this empty string as the first
  855. argument to ``patterns()``?"). For these reasons, we are deprecating it.
  856. Updating your code is as simple as ensuring that ``urlpatterns`` is a list of
  857. :func:`django.conf.urls.url` instances. For example::
  858. from django.conf.urls import url
  859. from myapp import views
  860. urlpatterns = [
  861. url('^$', views.myview),
  862. url('^other/$', views.otherview),
  863. ]
  864. Passing a string as ``view`` to :func:`~django.conf.urls.url`
  865. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  866. Related to the previous item, referencing views as strings in the ``url()``
  867. function is deprecated. Pass the callable view as described in the previous
  868. section instead.
  869. Template-related settings
  870. ~~~~~~~~~~~~~~~~~~~~~~~~~
  871. As a consequence of the multiple template engines refactor, several settings
  872. are deprecated in favor of :setting:`TEMPLATES`:
  873. * ``ALLOWED_INCLUDE_ROOTS``
  874. * ``TEMPLATE_CONTEXT_PROCESSORS``
  875. * ``TEMPLATE_DIRS``
  876. * ``TEMPLATE_LOADERS``
  877. * ``TEMPLATE_STRING_IF_INVALID``
  878. ``django.core.context_processors``
  879. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  880. Built-in template context processors have been moved to
  881. ``django.template.context_processors``.
  882. ``django.test.SimpleTestCase.urls``
  883. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  884. The attribute :attr:`SimpleTestCase.urls <django.test.SimpleTestCase.urls>`
  885. for specifying URLconf configuration in tests has been deprecated and will be
  886. removed in Django 2.0. Use :func:`@override_settings(ROOT_URLCONF=...)
  887. <django.test.override_settings>` instead.
  888. ``prefix`` argument to :func:`~django.conf.urls.i18n.i18n_patterns`
  889. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  890. Related to the previous item, the ``prefix`` argument to
  891. :func:`django.conf.urls.i18n.i18n_patterns` has been deprecated. Simply pass a
  892. list of :func:`django.conf.urls.url` instances instead.
  893. Using an incorrect count of unpacked values in the :ttag:`for` template tag
  894. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  895. Using an incorrect count of unpacked values in :ttag:`for` tag will raise an
  896. exception rather than fail silently in Django 2.0.
  897. Passing a dotted path to :func:`~django.core.urlresolvers.reverse()` and :ttag:`url`
  898. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  899. Reversing URLs by Python path is an expensive operation as it causes the
  900. path being reversed to be imported. This behavior has also resulted in a
  901. `security issue`_. Use :ref:`named URL patterns <naming-url-patterns>`
  902. for reversing instead.
  903. If you are using :mod:`django.contrib.sitemaps`, add the ``name`` argument to
  904. the ``url`` that references :func:`django.contrib.sitemaps.views.sitemap`::
  905. from django.contrib.sitemaps.views import sitemap
  906. url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
  907. name='django.contrib.sitemaps.views.sitemap')
  908. to ensure compatibility when reversing by Python path is removed in Django 2.0.
  909. Similarly for GIS sitemaps, add ``name='django.contrib.gis.sitemaps.views.kml'``
  910. or ``name='django.contrib.gis.sitemaps.views.kmz'``.
  911. .. _security issue: https://www.djangoproject.com/weblog/2014/apr/21/security/#s-issue-unexpected-code-execution-using-reverse
  912. Aggregate methods and modules
  913. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  914. The ``django.db.models.sql.aggregates`` and
  915. ``django.contrib.gis.db.models.sql.aggregates`` modules (both private API), have
  916. been deprecated as ``django.db.models.aggregates`` and
  917. ``django.contrib.gis.db.models.aggregates`` are now also responsible
  918. for SQL generation. The old modules will be removed in Django 2.0.
  919. If you were using the old modules, see :doc:`Query Expressions
  920. </ref/models/expressions>` for instructions on rewriting custom aggregates
  921. using the new stable API.
  922. The following methods and properties of ``django.db.models.sql.query.Query``
  923. have also been deprecated and the backwards compatibility shims will be removed
  924. in Django 2.0:
  925. * ``Query.aggregates``, replaced by ``annotations``.
  926. * ``Query.aggregate_select``, replaced by ``annotation_select``.
  927. * ``Query.add_aggregate()``, replaced by ``add_annotation()``.
  928. * ``Query.set_aggregate_mask()``, replaced by ``set_annotation_mask()``.
  929. * ``Query.append_aggregate_mask()``, replaced by ``append_annotation_mask()``.
  930. Extending management command arguments through ``Command.option_list``
  931. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  932. Management commands now use :py:mod:`argparse` instead of :py:mod:`optparse` to
  933. parse command-line arguments passed to commands. This also means that the way
  934. to add custom arguments to commands has changed: instead of extending the
  935. ``option_list`` class list, you should now override the
  936. :meth:`~django.core.management.BaseCommand.add_arguments` method and add
  937. arguments through ``argparse.add_argument()``. See
  938. :ref:`this example <custom-commands-options>` for more details.
  939. ``django.core.management.NoArgsCommand``
  940. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  941. The class :class:`~django.core.management.NoArgsCommand` is now deprecated and
  942. will be removed in Django 2.0. Use :class:`~django.core.management.BaseCommand`
  943. instead, which takes no arguments by default.
  944. Listing all migrations in a project
  945. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  946. The ``--list`` option of the :djadmin:`migrate` management command is
  947. deprecated and will be removed in Django 2.0. Use :djadmin:`showmigrations`
  948. instead.
  949. ``cache_choices`` option of ``ModelChoiceField`` and ``ModelMultipleChoiceField``
  950. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  951. :class:`~django.forms.ModelChoiceField` and
  952. :class:`~django.forms.ModelMultipleChoiceField` took an undocumented, untested
  953. option ``cache_choices``. This cached querysets between multiple renderings of
  954. the same ``Form`` object. This option is subject to an accelerated deprecation
  955. and will be removed in Django 1.9.
  956. ``django.template.resolve_variable()``
  957. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  958. The function has been informally marked as "Deprecated" for some time. Replace
  959. ``resolve_variable(path, context)`` with
  960. ``django.template.Variable(path).resolve(context)``.
  961. ``django.contrib.webdesign``
  962. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  963. It provided the :ttag:`lorem` template tag which is now included in the
  964. built-in tags. Simply remove ``'django.contrib.webdesign'`` from
  965. :setting:`INSTALLED_APPS` and ``{% load webdesign %}`` from your templates.
  966. ``error_message`` argument to ``django.forms.RegexField``
  967. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  968. It provided backwards compatibility for pre-1.0 code, but its functionality is
  969. redundant. Use ``Field.error_messages['invalid']`` instead.
  970. Old :tfilter:`unordered_list` syntax
  971. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  972. An older (pre-1.0), more restrictive and verbose input format for the
  973. :tfilter:`unordered_list` template filter has been deprecated::
  974. ``['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]``
  975. Using the new syntax, this becomes::
  976. ``['States', ['Kansas', ['Lawrence', 'Topeka'], 'Illinois']]``
  977. ``django.forms.Field._has_changed()``
  978. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  979. Rename this method to :meth:`~django.forms.Field.has_changed` by removing the
  980. leading underscore. The old name will still work until Django 2.0.
  981. ``django.utils.html.remove_tags()`` and ``removetags`` template filter
  982. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  983. ``django.utils.html.remove_tags()`` as well as the template filter
  984. ``removetags`` have been deprecated as they cannot guarantee safe output. Their
  985. existence is likely to lead to their use in security-sensitive contexts where
  986. they are not actually safe.
  987. The unused and undocumented ``django.utils.html.strip_entities()`` function has
  988. also been deprecated.
  989. ``is_admin_site`` argument to ``django.contrib.auth.views.password_reset()``
  990. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  991. It's a legacy option that should no longer be necessary.
  992. ``SubfieldBase``
  993. ~~~~~~~~~~~~~~~~
  994. ``django.db.models.fields.subclassing.SubfieldBase`` has been deprecated and
  995. will be removed in Django 2.0. Historically, it was used to handle fields where
  996. type conversion was needed when loading from the database, but it was not used
  997. in ``.values()`` calls or in aggregates. It has been replaced with
  998. :meth:`~django.db.models.Field.from_db_value`. Note that the new approach does
  999. not call the :meth:`~django.db.models.Field.to_python` method on assignment
  1000. as was the case with ``SubfieldBase``.
  1001. ``django.utils.checksums``
  1002. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1003. The ``django.utils.checksums`` module has been deprecated and will be removed
  1004. in Django 2.0. The functionality it provided (validating checksum using the
  1005. Luhn algorithm) was undocumented and not used in Django. The module has been
  1006. moved to the `django-localflavor`_ package (version 1.1+).
  1007. .. _django-localflavor: https://pypi.python.org/pypi/django-localflavor
  1008. ``django.contrib.admin.helpers.InlineAdminForm.original_content_type_id``
  1009. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1010. The ``original_content_type_id`` attribute on ``InlineAdminForm`` has been
  1011. deprecated and will be removed in Django 2.0. Historically, it was used
  1012. to construct the "view on site" URL. This URL is now accessible using the
  1013. ``absolute_url`` attribute of the form.
  1014. ``django.views.generic.edit.FormMixin.get_form()``’s ``form_class`` argument
  1015. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1016. ``FormMixin`` subclasses that override the ``get_form()`` method should make
  1017. sure to provide a default value for the ``form_class`` argument since it's
  1018. now optional.
  1019. ``current_app`` argument of template-related APIs
  1020. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1021. The following functions and classes will no longer accept a ``current_app``
  1022. parameter to set an URL namespace in Django 2.0:
  1023. * ``django.shortcuts.render()``
  1024. * ``django.template.Context()``
  1025. * ``django.template.RequestContext()``
  1026. * ``django.template.response.TemplateResponse()``
  1027. Set ``request.current_app`` instead, where ``request`` is the first argument
  1028. to these functions or classes. If you're using a plain ``Context``, use a
  1029. ``RequestContext`` instead.
  1030. ``dictionary`` and ``context_instance`` arguments of rendering functions
  1031. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1032. The following functions will no longer accept the ``dictionary`` and
  1033. ``context_instance`` parameters in Django 2.0:
  1034. * ``django.shortcuts.render()``
  1035. * ``django.shortcuts.render_to_response()``
  1036. * ``django.template.loader.render_to_string()``
  1037. Use the ``context`` parameter instead. When ``dictionary`` is passed as a
  1038. positional argument, which is the most common idiom, no changes are needed.
  1039. If you're passing a :class:`~django.template.Context` in ``context_instance``,
  1040. pass a :class:`dict` in the ``context`` parameter instead. If you're passing a
  1041. :class:`~django.template.RequestContext`, pass the request separately in the
  1042. ``request`` parameter.
  1043. ``dirs`` argument of template-finding functions
  1044. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1045. The following functions will no longer accept a ``dirs`` parameter to override
  1046. ``TEMPLATE_DIRS`` in Django 2.0:
  1047. * :func:`django.template.loader.get_template()`
  1048. * :func:`django.template.loader.select_template()`
  1049. * :func:`django.shortcuts.render()`
  1050. * :func:`django.shortcuts.render_to_response()`
  1051. The parameter didn't work consistently across different template loaders and
  1052. didn't work for included templates.
  1053. ``django.template.loader.BaseLoader``
  1054. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1055. ``django.template.loader.BaseLoader`` was renamed to
  1056. ``django.template.loaders.base.Loader``. If you've written a custom template
  1057. loader that inherits ``BaseLoader``, you must inherit ``Loader`` instead.
  1058. ``django.test.utils.TestTemplateLoader``
  1059. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1060. Private API ``django.test.utils.TestTemplateLoader`` is deprecated in favor of
  1061. ``django.template.loaders.locmem.Loader``.
  1062. ``qn`` replaced by ``compiler``
  1063. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1064. In previous Django versions, various internal ORM methods (mostly ``as_sql``
  1065. methods) accepted a ``qn`` (for "quote name") argument, which was a reference
  1066. to a function that quoted identifiers for sending to the database. In Django
  1067. 1.8, that argument has been renamed to ``compiler`` and is now a full
  1068. ``SQLCompiler`` instance. For backwards-compatibility, calling a
  1069. ``SQLCompiler`` instance performs the same name-quoting that the ``qn``
  1070. function used to. However, this backwards-compatibility shim is immediately
  1071. deprecated: you should rename your ``qn`` arguments to ``compiler``, and call
  1072. ``compiler.quote_name_unless_alias(...)`` where you previously called
  1073. ``qn(...)``.
  1074. Default value of ``RedirectView.permanent``
  1075. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1076. The default value of the
  1077. :attr:`RedirectView.permanent <django.views.generic.base.RedirectView.permanent>`
  1078. attribute will change from ``True`` to ``False`` in Django 1.9.
  1079. Using ``AuthenticationMiddleware`` without ``SessionAuthenticationMiddleware``
  1080. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1081. :class:`django.contrib.auth.middleware.SessionAuthenticationMiddleware` was
  1082. added in Django 1.7. In Django 1.7.2, its functionality was moved to
  1083. ``auth.get_user()`` and, for backwards compatibility, enabled only if
  1084. ``'django.contrib.auth.middleware.SessionAuthenticationMiddleware'`` appears in
  1085. :setting:`MIDDLEWARE_CLASSES`.
  1086. In Django 2.0, session verification will be enabled regardless of whether or not
  1087. ``SessionAuthenticationMiddleware`` is enabled (at which point
  1088. ``SessionAuthenticationMiddleware`` will have no significance). You can add it
  1089. to your ``MIDDLEWARE_CLASSES`` sometime before then to opt-in. Please read the
  1090. :ref:`upgrade considerations <session-invalidation-on-password-change>` first.
  1091. ``django.contrib.sitemaps.FlatPageSitemap``
  1092. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1093. ``django.contrib.sitemaps.FlatPageSitemap`` has moved to
  1094. ``django.contrib.flatpages.sitemaps.FlatPageSitemap``. The old import location
  1095. is deprecated and will be removed in Django 1.9.
  1096. Model ``Field.related``
  1097. ~~~~~~~~~~~~~~~~~~~~~~~
  1098. Private attribute ``django.db.models.Field.related`` is deprecated in favor
  1099. of ``Field.rel``. The latter is an instance of
  1100. ``django.db.models.fields.related.ForeignObjectRel`` which replaces
  1101. ``django.db.models.related.RelatedObject``. The ``django.db.models.related``
  1102. module has been removed and the ``Field.related`` attribute will be removed in
  1103. Django 2.0.
  1104. ``ssi`` template tag
  1105. ~~~~~~~~~~~~~~~~~~~~
  1106. The :ttag:`ssi` template tag allows files to be included in a template by
  1107. absolute path. This is of limited use in most deployment situations, and
  1108. the :ttag:`include` tag often makes more sense. This tag is now deprecated and
  1109. will be removed in Django 2.0.
  1110. ``=`` as comparison operator in ``if`` template tag
  1111. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1112. Using a single equals sign with the ``{% if %}`` template tag for equality
  1113. testing was undocumented and untested. It's now deprecated in favor of ``==``.
  1114. .. removed-features-1.8:
  1115. Features removed in 1.8
  1116. =======================
  1117. These features have reached the end of their deprecation cycle and so have been
  1118. removed in Django 1.8 (please see the :ref:`deprecation timeline
  1119. <deprecation-removed-in-1.8>` for more details):
  1120. * ``django.contrib.comments`` is removed.
  1121. * The following transaction management APIs are removed:
  1122. - ``TransactionMiddleware``
  1123. - the decorators and context managers ``autocommit``, ``commit_on_success``,
  1124. and ``commit_manually``, defined in ``django.db.transaction``
  1125. - the functions ``commit_unless_managed`` and ``rollback_unless_managed``,
  1126. also defined in ``django.db.transaction``
  1127. - the ``TRANSACTIONS_MANAGED`` setting
  1128. * The :ttag:`cycle` and :ttag:`firstof` template tags auto-escape their
  1129. arguments.
  1130. * The ``SEND_BROKEN_LINK_EMAILS`` setting is removed.
  1131. * ``django.middleware.doc.XViewMiddleware`` is removed.
  1132. * The ``Model._meta.module_name`` alias is removed.
  1133. * The backward compatible shims introduced to rename ``get_query_set``
  1134. and similar queryset methods are removed. This affects the following classes:
  1135. ``BaseModelAdmin``, ``ChangeList``, ``BaseCommentNode``,
  1136. ``GenericForeignKey``, ``Manager``, ``SingleRelatedObjectDescriptor`` and
  1137. ``ReverseSingleRelatedObjectDescriptor``.
  1138. * The backward compatible shims introduced to rename the attributes
  1139. ``ChangeList.root_query_set`` and ``ChangeList.query_set`` are removed.
  1140. * ``django.views.defaults.shortcut`` and ``django.conf.urls.shortcut`` are
  1141. removed.
  1142. * Support for the Python Imaging Library (PIL) module is removed.
  1143. * The following private APIs are removed:
  1144. - ``django.db.backend``
  1145. - ``django.db.close_connection()``
  1146. - ``django.db.backends.creation.BaseDatabaseCreation.set_autocommit()``
  1147. - ``django.db.transaction.is_managed()``
  1148. - ``django.db.transaction.managed()``
  1149. * ``django.forms.widgets.RadioInput`` is removed.
  1150. * The module ``django.test.simple`` and the class
  1151. ``django.test.simple.DjangoTestSuiteRunner`` are removed.
  1152. * The module ``django.test._doctest`` is removed.
  1153. * The ``CACHE_MIDDLEWARE_ANONYMOUS_ONLY`` setting is removed.
  1154. * Usage of the hard-coded *Hold down "Control", or "Command" on a Mac, to select
  1155. more than one.* string to override or append to user-provided ``help_text`` in
  1156. forms for ``ManyToMany`` model fields is not be performed by Django anymore
  1157. either at the model or forms layer.
  1158. * The ``Model._meta.get_(add|change|delete)_permission`` methods are removed.
  1159. * The session key ``django_language`` is no longer read for backwards
  1160. compatibility.
  1161. * Geographic Sitemaps are removed
  1162. (``django.contrib.gis.sitemaps.views.index`` and
  1163. ``django.contrib.gis.sitemaps.views.sitemap``).
  1164. * ``django.utils.html.fix_ampersands``, the ``fix_ampersands`` template filter,
  1165. and ``django.utils.html.clean_html`` are removed.