1.7.txt 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043
  1. ============================================
  2. Django 1.7 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. Welcome to Django 1.7!
  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.6 or older versions. We've also dropped some features, which are detailed in
  8. :doc:`our deprecation plan </internals/deprecation>`, and we've `begun the
  9. deprecation process for some features`_.
  10. .. _`new features`: `What's new in Django 1.7`_
  11. .. _`backwards incompatible changes`: `Backwards incompatible changes in 1.7`_
  12. .. _`begun the deprecation process for some features`: `Features deprecated in 1.7`_
  13. Python compatibility
  14. ====================
  15. Django 1.7 requires Python 2.7 or above, though we **highly recommend**
  16. the latest minor release. Support for Python 2.6 has been dropped.
  17. This change should affect only a small number of Django users, as most
  18. operating-system vendors today are shipping Python 2.7 or newer as their default
  19. version. If you're still using Python 2.6, however, you'll need to stick to
  20. Django 1.6 until you can upgrade your Python version. Per :doc:`our support
  21. policy </internals/release-process>`, Django 1.6 will continue to receive
  22. security support until the release of Django 1.8.
  23. What's new in Django 1.7
  24. ========================
  25. Schema migrations
  26. ~~~~~~~~~~~~~~~~~
  27. Django now has built-in support for schema migrations. It allows models
  28. to be updated, changed, and deleted by creating migration files that represent
  29. the model changes and which can be run on any development, staging or production
  30. database.
  31. Migrations are covered in :doc:`their own documentation</topics/migrations>`,
  32. but a few of the key features are:
  33. * ``syncdb`` has been deprecated and replaced by ``migrate``. Don't worry -
  34. calls to ``syncdb`` will still work as before.
  35. * A new ``makemigrations`` command provides an easy way to autodetect changes
  36. to your models and make migrations for them.
  37. :data:`~django.db.models.signals.pre_syncdb` and
  38. :data:`~django.db.models.signals.post_syncdb` have been replaced by
  39. :data:`~django.db.models.signals.pre_migrate` and
  40. :data:`~django.db.models.signals.post_migrate` respectively. These new
  41. signals have slightly different arguments. Check the documentation for
  42. details.
  43. * The ``allow_syncdb`` method on database routers is now called ``allow_migrate``,
  44. but still performs the same function. Routers with ``allow_syncdb`` methods
  45. will still work, but that method name is deprecated and you should change
  46. it as soon as possible (nothing more than renaming is required).
  47. App-loading refactor
  48. ~~~~~~~~~~~~~~~~~~~~
  49. Historically, Django applications were tightly linked to models. A singleton
  50. known as the "app cache" dealt with both installed applications and models.
  51. The models module was used as an identifier for applications in many APIs.
  52. As the concept of :doc:`Django applications </ref/applications>` matured, this
  53. code showed some shortcomings. It has been refactored into an "app registry"
  54. where models modules no longer have a central role and where it's possible to
  55. attach configuration data to applications.
  56. Improvements thus far include:
  57. * Applications can run code at startup, before Django does anything else, with
  58. the :meth:`~django.apps.AppConfig.ready` method of their configuration.
  59. * It is possible to omit ``models.py`` entirely if an application doesn't
  60. have any models.
  61. * Applications can be relabeled with the :attr:`~django.apps.AppConfig.label`
  62. attribute of application configurations, to work around label conflicts.
  63. * The name of applications can be customized in the admin with the
  64. :attr:`~django.apps.AppConfig.verbose_name` of application configurations.
  65. * Django imports all application configurations and models as soon as it
  66. starts, through a deterministic and straightforward process. This should
  67. make it easier to diagnose import issues such as import loops.
  68. New method on Field subclasses
  69. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  70. To help power both schema migrations and composite keys, the :class:`~django.db.models.Field` API now
  71. has a new required method: ``deconstruct()``.
  72. This method takes no arguments, and returns a tuple of four items:
  73. * ``name``: The field's attribute name on its parent model, or None if it is not part of a model
  74. * ``path``: A dotted, Python path to the class of this field, including the class name.
  75. * ``args``: Positional arguments, as a list
  76. * ``kwargs``: Keyword arguments, as a dict
  77. These four values allow any field to be serialized into a file, as well as
  78. allowing the field to be copied safely, both essential parts of these new features.
  79. This change should not affect you unless you write custom Field subclasses;
  80. if you do, you may need to reimplement the ``deconstruct()`` method if your
  81. subclass changes the method signature of ``__init__`` in any way. If your
  82. field just inherits from a built-in Django field and doesn't override ``__init__``,
  83. no changes are necessary.
  84. If you do need to override ``deconstruct()``, a good place to start is the
  85. built-in Django fields (``django/db/models/fields/__init__.py``) as several
  86. fields, including ``DecimalField`` and ``DateField``, override it and show how
  87. to call the method on the superclass and simply add or remove extra arguments.
  88. Calling custom ``QuerySet`` methods from the ``Manager``
  89. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  90. The :meth:`QuerySet.as_manager() <django.db.models.query.QuerySet.as_manager>`
  91. class method has been added to :ref:`create Manager with QuerySet methods
  92. <create-manager-with-queryset-methods>`.
  93. Using a custom manager when traversing reverse relations
  94. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  95. It is now possible to :ref:`specify a custom manager
  96. <using-custom-reverse-manager>` when traversing a reverse relationship.
  97. New ``Prefetch`` object for advanced ``prefetch_related`` operations.
  98. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  99. The new :class:`~django.db.models.Prefetch` object allows customizing
  100. prefetch operations.
  101. You can specify the ``QuerySet`` used to traverse a given relation
  102. or customize the storage location of prefetch results.
  103. This enables things like filtering prefetched relations, calling
  104. :meth:`~django.db.models.query.QuerySet.select_related()` from a prefetched
  105. relation, or prefetching the same relation multiple times with different
  106. querysets. See :meth:`~django.db.models.query.QuerySet.prefetch_related()`
  107. for more details.
  108. Admin shortcuts support time zones
  109. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110. The "today" and "now" shortcuts next to date and time input widgets in the
  111. admin are now operating in the :ref:`current time zone
  112. <default-current-time-zone>`. Previously, they used the browser time zone,
  113. which could result in saving the wrong value when it didn't match the current
  114. time zone on the server.
  115. In addition, the widgets now display a help message when the browser and
  116. server time zone are different, to clarify how the value inserted in the field
  117. will be interpreted.
  118. Using database cursors as context managers
  119. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  120. Prior to Python 2.7, database cursors could be used as a context manager. The
  121. specific backend's cursor defined the behavior of the context manager. The
  122. behavior of magic method lookups was changed with Python 2.7 and cursors were
  123. no longer usable as context managers.
  124. Django 1.7 allows a cursor to be used as a context manager that is a shortcut
  125. for the following, instead of backend specific behavior.
  126. .. code-block:: python
  127. c = connection.cursor()
  128. try:
  129. c.execute(...)
  130. finally:
  131. c.close()
  132. Minor features
  133. ~~~~~~~~~~~~~~
  134. :mod:`django.contrib.admin`
  135. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  136. * You can now implement :attr:`~django.contrib.admin.AdminSite.site_header`,
  137. :attr:`~django.contrib.admin.AdminSite.site_title`, and
  138. :attr:`~django.contrib.admin.AdminSite.index_title` attributes on a custom
  139. :class:`~django.contrib.admin.AdminSite` in order to easily change the admin
  140. site's page title and header text. No more needing to override templates!
  141. * Buttons in :mod:`django.contrib.admin` now use the ``border-radius`` CSS
  142. property for rounded corners rather than GIF background images.
  143. * Some admin templates now have ``app-<app_name>`` and ``model-<model_name>``
  144. classes in their ``<body>`` tag to allow customizing the CSS per app or per
  145. model.
  146. * The admin changelist cells now have a ``field-<field_name>`` class in the
  147. HTML to enable style customizations.
  148. * The admin's search fields can now be customized per-request thanks to the new
  149. :meth:`django.contrib.admin.ModelAdmin.get_search_fields` method.
  150. * The :meth:`ModelAdmin.get_fields()
  151. <django.contrib.admin.ModelAdmin.get_fields>` method may be overridden to
  152. customize the value of :attr:`ModelAdmin.fields
  153. <django.contrib.admin.ModelAdmin.fields>`.
  154. * In addition to the existing ``admin.site.register`` syntax, you can use the
  155. new :func:`~django.contrib.admin.register` decorator to register a
  156. :class:`~django.contrib.admin.ModelAdmin`.
  157. * You may specify :meth:`ModelAdmin.list_display_links
  158. <django.contrib.admin.ModelAdmin.list_display_links>` ``= None`` to disable
  159. links on the change list page grid.
  160. * You may now specify :attr:`ModelAdmin.view_on_site
  161. <django.contrib.admin.ModelAdmin.view_on_site>` to control whether or not to
  162. display the "View on site" link.
  163. :mod:`django.contrib.auth`
  164. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  165. * Any ``**kwargs`` passed to
  166. :meth:`~django.contrib.auth.models.User.email_user()` are passed to the
  167. underlying :meth:`~django.core.mail.send_mail()` call.
  168. * The :func:`~django.contrib.auth.decorators.permission_required` decorator can
  169. take a list of permissions as well as a single permission.
  170. * You can override the new :meth:`AuthenticationForm.confirm_login_allowed()
  171. <django.contrib.auth.forms.AuthenticationForm.confirm_login_allowed>` method
  172. to more easily customize the login policy.
  173. * :func:`django.contrib.auth.views.password_reset` takes an optional
  174. ``html_email_template_name`` parameter used to send a multipart HTML email
  175. for password resets.
  176. :mod:`django.contrib.gis`
  177. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  178. * The default OpenLayers library version included in widgets has been updated
  179. from 2.11 to 2.13.
  180. * Prepared geometries now also support the ``crosses``, ``disjoint``,
  181. ``overlaps``, ``touches`` and ``within`` predicates, if GEOS 3.3 or later is
  182. installed.
  183. :mod:`django.contrib.messages`
  184. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  185. * The backends for :mod:`django.contrib.messages` that use cookies, will now
  186. follow the :setting:`SESSION_COOKIE_SECURE` and
  187. :setting:`SESSION_COOKIE_HTTPONLY` settings.
  188. * The :ref:`messages context processor <message-displaying>` now adds a
  189. dictionary of default levels under the name ``DEFAULT_MESSAGE_LEVELS``.
  190. * :class:`~django.contrib.messages.storage.base.Message` objects now have a
  191. ``level_tag`` attribute that contains the string representation of the
  192. message level.
  193. :mod:`django.contrib.redirects`
  194. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  195. * :class:`~django.contrib.redirects.middleware.RedirectFallbackMiddleware`
  196. has two new attributes
  197. (:attr:`~django.contrib.redirects.middleware.RedirectFallbackMiddleware.response_gone_class`
  198. and
  199. :attr:`~django.contrib.redirects.middleware.RedirectFallbackMiddleware.response_redirect_class`)
  200. that specify the types of :class:`~django.http.HttpResponse` instances the
  201. middleware returns.
  202. :mod:`django.contrib.sessions`
  203. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  204. * The ``"django.contrib.sessions.backends.cached_db"`` session backend now
  205. respects :setting:`SESSION_CACHE_ALIAS`. In previous versions, it always used
  206. the `default` cache.
  207. :mod:`django.contrib.sitemaps`
  208. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  209. * The :mod:`sitemap framework<django.contrib.sitemaps>` now makes use of
  210. :attr:`~django.contrib.sitemaps.Sitemap.lastmod` to set a ``Last-Modified``
  211. header in the response. This makes it possible for the
  212. :class:`~django.middleware.http.ConditionalGetMiddleware` to handle
  213. conditional ``GET`` requests for sitemaps which set ``lastmod``.
  214. :mod:`django.contrib.staticfiles`
  215. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  216. * The :ref:`static files storage classes <staticfiles-storages>` may be
  217. subclassed to override the permissions that collected static files and
  218. directories receive by setting the
  219. :attr:`~django.core.files.storage.FileSystemStorage.file_permissions_mode`
  220. and :attr:`~django.core.files.storage.FileSystemStorage.directory_permissions_mode`
  221. parameters. See :djadmin:`collectstatic` for example usage.
  222. :mod:`django.contrib.syndication`
  223. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  224. * The :class:`~django.utils.feedgenerator.Atom1Feed` syndication feed's
  225. ``updated`` element now utilizes ``updateddate`` instead of ``pubdate``,
  226. allowing the ``published`` element to be included in the feed (which
  227. relies on ``pubdate``).
  228. Cache
  229. ^^^^^
  230. * Access to caches configured in :setting:`CACHES` is now available via
  231. :data:`django.core.cache.caches`. This dict-like object provides a different
  232. instance per thread. It supersedes :func:`django.core.cache.get_cache` which
  233. is now deprecated.
  234. * If you instanciate cache backends directly, be aware that they aren't
  235. thread-safe any more, as :data:`django.core.cache.caches` now yields
  236. different instances per thread.
  237. Email
  238. ^^^^^
  239. * :func:`~django.core.mail.send_mail` now accepts an ``html_message``
  240. parameter for sending a multipart ``text/plain`` and ``text/html`` email.
  241. * The SMTP :class:`~django.core.mail.backends.smtp.EmailBackend` now accepts a
  242. :attr:`~django.core.mail.backends.smtp.EmailBackend.timeout` parameter.
  243. File Uploads
  244. ^^^^^^^^^^^^
  245. * The new :attr:`UploadedFile.content_type_extra
  246. <django.core.files.uploadedfile.UploadedFile.content_type_extra>` attribute
  247. contains extra parameters passed to the ``content-type`` header on a file
  248. upload.
  249. * The new :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS` setting controls
  250. the file system permissions of directories created during file upload, like
  251. :setting:`FILE_UPLOAD_PERMISSIONS` does for the files themselves.
  252. * The :attr:`FileField.upload_to <django.db.models.FileField.upload_to>`
  253. attribute is now optional. If it is omitted or given ``None`` or an empty
  254. string, a subdirectory won't be used for storing the uploaded files.
  255. Forms
  256. ^^^^^
  257. * The ``<label>`` and ``<input>`` tags rendered by
  258. :class:`~django.forms.RadioSelect` and
  259. :class:`~django.forms.CheckboxSelectMultiple` when looping over the radio
  260. buttons or checkboxes now include ``for`` and ``id`` attributes, respectively.
  261. Each radio button or checkbox includes an ``id_for_label`` attribute to
  262. output the element's ID.
  263. * :attr:`Field.choices<django.db.models.Field.choices>` now allows you to
  264. customize the "empty choice" label by including a tuple with an empty string
  265. or ``None`` for the key and the custom label as the value. The default blank
  266. option ``"----------"`` will be omitted in this case.
  267. * :class:`~django.forms.MultiValueField` allows optional subfields by setting
  268. the ``require_all_fields`` argument to ``False``. The ``required`` attribute
  269. for each individual field will be respected, and a new ``incomplete``
  270. validation error will be raised when any required fields are empty.
  271. * The :meth:`~django.forms.Form.clean` method on a form no longer needs to
  272. return ``self.cleaned_data``. If it does return a changed dictionary then
  273. that will still be used.
  274. * After a temporary regression in Django 1.6, it's now possible again to make
  275. :class:`~django.forms.TypedChoiceField` ``coerce`` method return an arbitrary
  276. value.
  277. * :attr:`SelectDateWidget.months
  278. <django.forms.extras.widgets.SelectDateWidget.months>` can be used to
  279. customize the wording of the months displayed in the select widget.
  280. * The ``min_num`` and ``validate_min`` parameters were added to
  281. :func:`~django.forms.formsets.formset_factory` to allow validating
  282. a minimum number of submitted forms.
  283. * The metaclasses used by ``Form`` and ``ModelForm`` have been reworked to
  284. support more inheritance scenarios. The previous limitation that prevented
  285. inheriting from both ``Form`` and ``ModelForm`` simultaneously have been
  286. removed as long as ``ModelForm`` appears first in the MRO.
  287. * It's now possible to opt-out from a ``Form`` field declared in a parent class
  288. by shadowing it with a non-``Field`` value.
  289. * The new :meth:`~django.forms.Form.add_error()` method allows adding errors
  290. to specific form fields.
  291. * The dict-like attribute :attr:`~django.forms.Form.errors` now has two new
  292. methods :meth:`~django.forms.Form.errors.as_data()` and
  293. :meth:`~django.forms.Form.errors.as_json()`. The former returns a ``dict``
  294. that maps fields to their original errors, complete with all metadata
  295. (error code and params), the latter returns the errors serialized as json.
  296. Internationalization
  297. ^^^^^^^^^^^^^^^^^^^^
  298. * The :attr:`django.middleware.locale.LocaleMiddleware.response_redirect_class`
  299. attribute allows you to customize the redirects issued by the middleware.
  300. * The :class:`~django.middleware.locale.LocaleMiddleware` now stores the user's
  301. selected language with the session key ``_language``. Previously it was
  302. stored with the key ``django_language``, but keys reserved for Django should
  303. start with an underscore. For backwards compatibility ``django_language`` is
  304. still read from in 1.7. Sessions will be migrated to the new ``_language``
  305. key as they are written.
  306. * The :ttag:`blocktrans` now supports a ``trimmed`` option. This
  307. option will remove newline characters from the beginning and the end of the
  308. content of the ``{% blocktrans %}`` tag, replace any whitespace at the
  309. beginning and end of a line and merge all lines into one using a space
  310. character to separate them. This is quite useful for indenting the content of
  311. a ``{% blocktrans %}`` tag without having the indentation characters end up
  312. in the corresponding entry in the PO file, which makes the translation
  313. process easier.
  314. * When you run :djadmin:`makemessages` from the root directory of your project,
  315. any extracted strings will now be automatically distributed to the proper
  316. app or project message file. See :ref:`how-to-create-language-files` for
  317. details.
  318. Management Commands
  319. ^^^^^^^^^^^^^^^^^^^
  320. * The :djadminopt:`--no-color` option for ``django-admin.py`` allows you to
  321. disable the colorization of management command output.
  322. * The new :djadminopt:`--natural-foreign` and :djadminopt:`--natural-primary`
  323. options for :djadmin:`dumpdata`, and the new ``use_natural_foreign_keys`` and
  324. ``use_natural_primary_keys`` arguments for ``serializers.serialize()``, allow
  325. the use of natural primary keys when serializing.
  326. * It is no longer necessary to provide the cache table name or the
  327. :djadminopt:`--database` option for the :djadmin:`createcachetable` command.
  328. Django takes this information from your settings file. If you have configured
  329. multiple caches or multiple databases, all cache tables are created.
  330. * The :djadmin:`runserver` command received several improvements:
  331. * On Linux systems, if pyinotify_ is installed, the development server will
  332. reload immediately when a file is changed. Previously, it polled the
  333. filesystem for changes every second. That caused a small delay before
  334. reloads and reduced battery life on laptops.
  335. .. _pyinotify: https://pypi.python.org/pypi/pyinotify
  336. * In addition, the development server automatically reloads when a
  337. translation file is updated, i.e. after running
  338. :djadmin:`compilemessages`.
  339. * All HTTP requests are logged to the console, including requests for static
  340. files or ``favicon.ico`` that used to be filtered out.
  341. * Management commands can now produce syntax colored output under Windows if
  342. the ANSICON third-party tool is installed and active.
  343. Models
  344. ^^^^^^
  345. * The :meth:`QuerySet.update_or_create()
  346. <django.db.models.query.QuerySet.update_or_create>` method was added.
  347. * The new :attr:`~django.db.models.Options.default_permissions` model
  348. ``Meta`` option allows you to customize (or disable) creation of the default
  349. add, change, and delete permissions.
  350. * Explicit :class:`~django.db.models.OneToOneField` for
  351. :ref:`multi-table-inheritance` are now discovered in abstract classes.
  352. * Is it now possible to avoid creating a backward relation for
  353. :class:`~django.db.models.OneToOneField` by setting its
  354. :attr:`~django.db.models.ForeignKey.related_name` to
  355. ``'+'`` or ending it with ``'+'``.
  356. * :class:`F expressions <django.db.models.F>` support the power operator
  357. (``**``).
  358. * The ``remove()`` and ``clear()`` methods of the related managers created by
  359. ``ForeignKey`` and ``GenericForeignKey`` now accept the ``bulk`` keyword
  360. argument to control whether or not to perform operations in bulk
  361. (i.e. using ``QuerySet.update()``). Defaults to ``True``.
  362. * It is now possible to use ``None`` as a query value for the :lookup:`iexact`
  363. lookup.
  364. Signals
  365. ^^^^^^^
  366. * The ``enter`` argument was added to the
  367. :data:`~django.test.signals.setting_changed` signal.
  368. * The model signals can be now be connected to using a ``str`` of the
  369. ``'app_label.ModelName'`` form – just like related fields – to lazily
  370. reference their senders.
  371. Templates
  372. ^^^^^^^^^
  373. * The :meth:`Context.push() <django.template.Context.push>` method now returns
  374. a context manager which automatically calls :meth:`pop()
  375. <django.template.Context.pop>` upon exiting the ``with`` statement.
  376. Additionally, :meth:`push() <django.template.Context.push>` now accepts
  377. parameters that are passed to the ``dict`` constructor used to build the new
  378. context level.
  379. * The :ttag:`widthratio` template tag now accepts an "as" parameter to capture
  380. the result in a variable.
  381. * The :ttag:`include` template tag will now also accept anything with a
  382. ``render()`` method (such as a ``Template``) as an argument. String
  383. arguments will be looked up using
  384. :func:`~django.template.loader.get_template` as always.
  385. * It is now possible to :ttag:`include` templates recursively.
  386. * Template objects now have an origin attribute set when
  387. :setting:`TEMPLATE_DEBUG` is ``True``. This allows template origins to be
  388. inspected and logged outside of the ``django.template`` infrastructure.
  389. * ``TypeError`` exceptions are no longer silenced when raised during the
  390. rendering of a template.
  391. * The following functions now accept a ``dirs`` parameter which is a list or
  392. tuple to override :setting:`TEMPLATE_DIRS`:
  393. * :func:`django.template.loader.get_template()`
  394. * :func:`django.template.loader.select_template()`
  395. * :func:`django.shortcuts.render()`
  396. * :func:`django.shortcuts.render_to_response()`
  397. * The :tfilter:`time` filter now accepts timzone-related :ref:`format
  398. specifiers <date-and-time-formatting-specifiers>` ``'e'``, ``'O'`` , ``'T'``
  399. and ``'Z'`` and is able to digest :ref:`time-zone-aware
  400. <naive_vs_aware_datetimes>` ``datetime`` instances performing the expected
  401. rendering.
  402. * The :ttag:`cache` tag will now try to use the cache called
  403. "template_fragments" if it exists and fall back to using the default cache
  404. otherwise. It also now accepts an optional ``using`` keyword argument to
  405. control which cache it uses.
  406. Requests
  407. ^^^^^^^^
  408. * The new :attr:`HttpRequest.scheme <django.http.HttpRequest.scheme>` attribute
  409. specifies the scheme of the request (``http`` or ``https`` normally).
  410. Tests
  411. ^^^^^
  412. * :class:`~django.test.runner.DiscoverRunner` has two new attributes,
  413. :attr:`~django.test.runner.DiscoverRunner.test_suite` and
  414. :attr:`~django.test.runner.DiscoverRunner.test_runner`, which facilitate
  415. overriding the way tests are collected and run.
  416. * The ``fetch_redirect_response`` argument was added to
  417. :meth:`~django.test.SimpleTestCase.assertRedirects`. Since the test
  418. client can't fetch externals URLs, this allows you to use ``assertRedirects``
  419. with redirects that aren't part of your Django app.
  420. * Correct handling of scheme when making comparisons in
  421. :meth:`~django.test.SimpleTestCase.assertRedirects`.
  422. * The ``secure`` argument was added to all the request methods of
  423. :class:`~django.test.Client`. If ``True``, the request will be made
  424. through HTTPS.
  425. * Requests made with :meth:`Client.login() <django.test.Client.login>` and
  426. :meth:`Client.logout() <django.test.Client.logout>` respect defaults defined
  427. in :class:`~django.test.Client` instantiation and are processed through
  428. middleware.
  429. * :meth:`~django.test.TransactionTestCase.assertNumQueries` now prints
  430. out the list of executed queries if the assertion fails.
  431. Validators
  432. ^^^^^^^^^^
  433. * :class:`~django.core.validators.URLValidator` now accepts an optional
  434. ``schemes`` argument which allows customization of the accepted URI schemes
  435. (instead of the defaults ``http(s)`` and ``ftp(s)``).
  436. Backwards incompatible changes in 1.7
  437. =====================================
  438. .. warning::
  439. In addition to the changes outlined in this section, be sure to review the
  440. :doc:`deprecation plan </internals/deprecation>` for any features that
  441. have been removed. If you haven't updated your code within the
  442. deprecation timeline for a given feature, its removal may appear as a
  443. backwards incompatible change.
  444. allow_syncdb/allow_migrate
  445. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  446. While Django will still look at ``allow_syncdb`` methods even though they
  447. should be renamed to ``allow_migrate``, there is a subtle difference in which
  448. models get passed to these methods.
  449. For apps with migrations, ``allow_migrate`` will now get passed
  450. :ref:`historical models <historical-models>`, which are special versioned models
  451. without custom attributes, methods or managers. Make sure your ``allow_migrate``
  452. methods are only referring to fields or other items in ``model._meta``.
  453. App-loading changes
  454. ~~~~~~~~~~~~~~~~~~~
  455. Start-up sequence
  456. ^^^^^^^^^^^^^^^^^
  457. Django 1.7 loads application configurations and models as soon as it starts.
  458. While this behavior is more straightforward and is believed to be more robust,
  459. regressions cannot be ruled out. You may encounter the following exceptions:
  460. * ``RuntimeError: App registry isn't ready yet.`` This happens when importing
  461. an application configuration or a models module triggers code that depends
  462. on the app registry.
  463. For example, :func:`~django.utils.translation.ugettext()` uses the app
  464. registry to look up translation catalogs in applications. To translate at
  465. import time, you need :func:`~django.utils.translation.ugettext_lazy()`
  466. instead. (Using :func:`~django.utils.translation.ugettext()` would be a bug,
  467. because the translation would happen at import time, rather than at each
  468. request depending on the active language.)
  469. Executing database queries with the ORM at import time in models modules
  470. will also trigger this exception. The ORM cannot function properly until all
  471. models are available.
  472. * ``ImportError: cannot import name ...`` This happens if the import sequence
  473. ends up in a loop.
  474. To eliminate such problems, you should minimize dependencies between your
  475. models modules and do as little work as possible at import time. To avoid
  476. executing code at import time, you can move it into a function and cache its
  477. results. The code will be executed when you first need its results. This
  478. concept is known as "lazy evaluation".
  479. Standalone scripts
  480. ^^^^^^^^^^^^^^^^^^
  481. If you're using Django in a plain Python script — rather than a management
  482. command — and you rely on the :envvar:`DJANGO_SETTINGS_MODULE` environment
  483. variable, you must now explicitly initialize Django at the beginning of your
  484. script with::
  485. >>> import django
  486. >>> django.setup()
  487. Otherwise, you will hit ``RuntimeError: App registry isn't ready yet.``
  488. App registry consistency
  489. ^^^^^^^^^^^^^^^^^^^^^^^^
  490. It is no longer possible to have multiple installed applications with the same
  491. label. In previous versions of Django, this didn't always work correctly, but
  492. didn't crash outright either.
  493. If you have two apps with the same label, you should create an
  494. :class:`~django.apps.AppConfig` for one of them and override its
  495. :class:`~django.apps.AppConfig.label` there. You should then adjust your code
  496. wherever it references this application or its models with the old label.
  497. You should make sure that your project doesn't import models from applications
  498. that aren't in :setting:`INSTALLED_APPS`. Relations involving such models may
  499. not be created properly. Future versions of Django may forbid this entirely.
  500. Subclassing AppCommand
  501. ^^^^^^^^^^^^^^^^^^^^^^
  502. Subclasses of :class:`~django.core.management.AppCommand` must now implement a
  503. :meth:`~django.core.management.AppCommand.handle_app_config` method instead of
  504. ``handle_app()``. This method receives an :class:`~django.apps.AppConfig`
  505. instance instead of a models module.
  506. Introspecting applications
  507. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  508. Since :setting:`INSTALLED_APPS` now supports application configuration classes
  509. in addition to application modules, you should review code that accesses this
  510. setting directly and use the app registry (:attr:`django.apps.apps`) instead.
  511. The app registry has preserved some features of the old app cache. Even though
  512. the app cache was a private API, obsolete methods and arguments will be
  513. removed through a standard deprecation path, with the exception of the
  514. following changes that take effect immediately:
  515. * ``get_model`` raises :exc:`~exceptions.LookupError` instead of returning
  516. ``None`` when no model is found.
  517. * The ``only_installed`` argument of ``get_model`` and ``get_models`` no
  518. longer exists, nor does the ``seed_cache`` argument of ``get_model``.
  519. Management commands and order of :setting:`INSTALLED_APPS`
  520. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  521. When several applications provide management commands with the same name,
  522. Django loads the command from the application that comes first in
  523. :setting:`INSTALLED_APPS`. Previous versions loaded the command from the
  524. applicatino that came last.
  525. This brings discovery of management commands in line with other parts of
  526. Django that rely on the order of :setting:`INSTALLED_APPS`, such as static
  527. files, templates, and translations.
  528. Behavior of ``LocMemCache`` regarding pickle errors
  529. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  530. An inconsistency existed in previous versions of Django regarding how pickle
  531. errors are handled by different cache backends.
  532. ``django.core.cache.backends.locmem.LocMemCache`` used to fail silently when
  533. such an error occurs, which is inconsistent with other backends and leads to
  534. cache-specific errors. This has been fixed in Django 1.7, see
  535. `Ticket #21200`_ for more details.
  536. .. _Ticket #21200: https://code.djangoproject.com/ticket/21200
  537. Cache keys are now generated from the request's absolute URL
  538. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  539. Previous versions of Django generated cache keys using a request's path and
  540. query string but not the scheme or host. If a Django application was serving
  541. multiple subdomains or domains, cache keys could collide. In Django 1.7, cache
  542. keys vary by the absolute URL of the request including scheme, host, path, and
  543. query string. For example, the URL portion of a cache key is now generated from
  544. ``http://www.example.com/path/to/?key=val`` rather than ``/path/to/?key=val``.
  545. The cache keys generated by Django 1.7 will be different from the keys
  546. generated by older versions of Django. After upgrading to Django 1.7, the first
  547. request to any previously cached URL will be a cache miss .
  548. Passing ``None`` to ``Manager.db_manager()``
  549. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  550. In previous versions of Django, it was possible to use
  551. ``db_manager(using=None)`` on a model manager instance to obtain a manager
  552. instance using default routing behavior, overriding any manually specified
  553. database routing. In Django 1.7, a value of ``None`` passed to db_manager will
  554. produce a router that *retains* any manually assigned database routing -- the
  555. manager will *not* be reset. This was necessary to resolve an inconsistency in
  556. the way routing information cascaded over joins. See `Ticket #13724`_ for more
  557. details.
  558. .. _Ticket #13724: https://code.djangoproject.com/ticket/13724
  559. pytz may be required
  560. ~~~~~~~~~~~~~~~~~~~~
  561. If your project handles datetimes before 1970 or after 2037 and Django raises
  562. a :exc:`~exceptions.ValueError` when encountering them, you will have to
  563. install pytz_. You may be affected by this problem if you use Django's time
  564. zone-related date formats or :mod:`django.contrib.syndication`.
  565. ``remove()`` and ``clear()`` methods of related managers
  566. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  567. The ``remove()`` and ``clear()`` methods of the related managers created by
  568. ``ForeignKey``, ``GenericForeignKey``, and ``ManyToManyField`` suffered from a
  569. number of issues. Some operations ran multiple data modifying queries without
  570. wrapping them in a transaction, and some operations didn't respect default
  571. filtering when it was present (i.e. when the default manager on the related
  572. model implemented a custom ``get_queryset()``).
  573. Fixing the issues introduced some backward incompatible changes:
  574. - The default implementation of ``remove()`` for ``ForeignKey`` related managers
  575. changed from a series of ``Model.save()`` calls to a single
  576. ``QuerySet.update()`` call. The change means that ``pre_save`` and
  577. ``post_save`` signals aren't sent anymore. You can use the ``bulk=False``
  578. keyword argument to revert to the previous behavior.
  579. - The ``remove()`` and ``clear()`` methods for ``GenericForeignKey`` related
  580. managers now perform bulk delete. The ``Model.delete()`` method isn't called
  581. on each instance anymore. You can use the ``bulk=False`` keyword argument to
  582. revert to the previous behavior.
  583. - The ``remove()`` and ``clear()`` methods for ``ManyToManyField`` related
  584. managers perform nested queries when filtering is involved, which may or
  585. may not be an issue depending on your database and your data itself.
  586. See :ref:`this note <nested-queries-performance>` for more details.
  587. .. _pytz: https://pypi.python.org/pypi/pytz/
  588. Miscellaneous
  589. ~~~~~~~~~~~~~
  590. * The :meth:`django.core.files.uploadhandler.FileUploadHandler.new_file()`
  591. method is now passed an additional ``content_type_extra`` parameter. If you
  592. have a custom :class:`~django.core.files.uploadhandler.FileUploadHandler`
  593. that implements ``new_file()``, be sure it accepts this new parameter.
  594. * :class:`ModelFormSet<django.forms.models.BaseModelFormSet>`’s no longer
  595. delete instances when ``save(commit=False)`` is called. See
  596. :attr:`~django.forms.formsets.BaseFormSet.can_delete` for instructions on how
  597. to manually delete objects from deleted forms.
  598. * Loading empty fixtures emits a ``RuntimeWarning`` rather than raising
  599. :class:`~django.core.management.CommandError`.
  600. * :func:`django.contrib.staticfiles.views.serve` will now raise an
  601. :exc:`~django.http.Http404` exception instead of
  602. :exc:`~django.core.exceptions.ImproperlyConfigured` when :setting:`DEBUG`
  603. is ``False``. This change removes the need to conditionally add the view to
  604. your root URLconf, which in turn makes it safe to reverse by name. It also
  605. removes the ability for visitors to generate spurious HTTP 500 errors by
  606. requesting static files that don't exist or haven't been collected yet.
  607. * The :meth:`django.db.models.Model.__eq__` method is now defined in a
  608. way where instances of a proxy model and its base model are considered
  609. equal when primary keys match. Previously only instances of exact same
  610. class were considered equal on primary key match.
  611. * The :meth:`django.db.models.Model.__eq__` method has changed such that
  612. two ``Model`` instances without primary key values won't be considered
  613. equal (unless they are the same instance).
  614. * The :meth:`django.db.models.Model.__hash__` will now raise ``TypeError``
  615. when called on an instance without a primary key value. This is done to
  616. avoid mutable ``__hash__`` values in containers.
  617. * :class:`~django.db.models.AutoField` columns in SQLite databases will now be
  618. created using the ``AUTOINCREMENT`` option, which guarantees monotonic
  619. increments. This will cause primary key numbering behavior to change on
  620. SQLite, becoming consistent with most other SQL databases. This will only
  621. apply to newly created tables. If you have a database created with an older
  622. version of Django, you will need to migrate it to take advantage of this
  623. feature. For example, you could do the following:
  624. #) Use :djadmin:`dumpdata` to save your data.
  625. #) Rename the existing database file (keep it as a backup).
  626. #) Run :djadmin:`migrate` to create the updated schema.
  627. #) Use :djadmin:`loaddata` to import the fixtures you exported in (1).
  628. * ``django.contrib.auth.models.AbstractUser`` no longer defines a
  629. :meth:`~django.db.models.Model.get_absolute_url()` method. The old definition
  630. returned ``"/users/%s/" % urlquote(self.username)`` which was arbitrary
  631. since applications may or may not define such a url in ``urlpatterns``.
  632. Define a ``get_absolute_url()`` method on your own custom user object or use
  633. :setting:`ABSOLUTE_URL_OVERRIDES` if you want a URL for your user.
  634. * The static asset-serving functionality of the
  635. :class:`django.test.LiveServerTestCase` class has been simplified: Now it's
  636. only able to serve content already present in :setting:`STATIC_ROOT` when
  637. tests are run. The ability to transparently serve all the static assets
  638. (similarly to what one gets with :setting:`DEBUG = True <DEBUG>` at
  639. development-time) has been moved to a new class that lives in the
  640. ``staticfiles`` application (the one actually in charge of such feature):
  641. :class:`django.contrib.staticfiles.testing.StaticLiveServerCase`. In other
  642. words, ``LiveServerTestCase`` itself is less powerful but at the same time
  643. has less magic.
  644. Rationale behind this is removal of dependency of non-contrib code on
  645. contrib applications.
  646. * The old cache URI syntax (e.g. ``"locmem://"``) is no longer supported. It
  647. still worked, even though it was not documented or officially supported. If
  648. you're still using it, please update to the current :setting:`CACHES` syntax.
  649. * The default ordering of ``Form`` fields in case of inheritance has changed to
  650. follow normal Python MRO. Fields are now discovered by iterating through the
  651. MRO in reverse with the topmost class coming last. This only affects you if
  652. you relied on the default field ordering while having fields defined on both
  653. the current class *and* on a parent ``Form``.
  654. * The ``required`` argument of
  655. :class:`~django.forms.extras.widgets.SelectDateWidget` has been removed.
  656. This widget now respects the form field's ``is_required`` attribute like
  657. other widgets.
  658. * :meth:`~django.db.models.query.QuerySet.select_related` now chains in the
  659. same way as other similar calls like ``prefetch_related``. That is,
  660. ``select_related('foo', 'bar')`` is equivalent to
  661. ``select_related('foo').select_related('bar')``. Previously the latter would
  662. have been equivalent to ``select_related('bar')``.
  663. * GeoDjango dropped support for GEOS < 3.1.
  664. Features deprecated in 1.7
  665. ==========================
  666. ``django.core.cache.get_cache``
  667. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  668. :func:`django.core.cache.get_cache` has been supplanted by
  669. :data:`django.core.cache.caches`.
  670. ``django.utils.dictconfig``/``django.utils.importlib``
  671. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  672. ``django.utils.dictconfig`` and ``django.utils.importlib`` were copies of
  673. respectively :mod:`logging.config` and :mod:`importlib` provided for Python
  674. versions prior to 2.7. They have been deprecated.
  675. ``django.utils.tzinfo``
  676. ~~~~~~~~~~~~~~~~~~~~~~~
  677. ``django.utils.tzinfo`` provided two :class:`~datetime.tzinfo` subclasses,
  678. ``LocalTimezone`` and ``FixedOffset``. They've been deprecated in favor of
  679. more correct alternatives provided by :mod:`django.utils.timezone`,
  680. :func:`django.utils.timezone.get_default_timezone` and
  681. :func:`django.utils.timezone.get_fixed_timezone`.
  682. ``django.utils.unittest``
  683. ~~~~~~~~~~~~~~~~~~~~~~~~~
  684. ``django.utils.unittest`` provided uniform access to the ``unittest2`` library
  685. on all Python versions. Since ``unittest2`` became the standard library's
  686. :mod:`unittest` module in Python 2.7, and Django 1.7 drops support for older
  687. Python versions, this module isn't useful anymore. It has been deprecated. Use
  688. :mod:`unittest` instead.
  689. ``django.utils.datastructures.SortedDict``
  690. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  691. As :class:`~collections.OrderedDict` was added to the standard library in
  692. Python 2.7, :class:`~django.utils.datastructures.SortedDict` is no longer
  693. needed and has been deprecated.
  694. Custom SQL location for models package
  695. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  696. Previously, if models were organized in a package (``myapp/models/``) rather
  697. than simply ``myapp/models.py``, Django would look for :ref:`initial SQL data
  698. <initial-sql>` in ``myapp/models/sql/``. This bug has been fixed so that Django
  699. will search ``myapp/sql/`` as documented. The old location will continue to
  700. work until Django 1.9.
  701. ``declared_fieldsets`` attribute on ``ModelAdmin``
  702. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  703. ``ModelAdmin.declared_fieldsets`` has been deprecated. Despite being a private
  704. API, it will go through a regular deprecation path. This attribute was mostly
  705. used by methods that bypassed ``ModelAdmin.get_fieldsets()`` but this was
  706. considered a bug and has been addressed.
  707. ``syncdb``
  708. ~~~~~~~~~~
  709. The ``syncdb`` command has been deprecated in favour of the new ``migrate``
  710. command. ``migrate`` takes the same arguments as ``syncdb`` used to plus a few
  711. more, so it's safe to just change the name you're calling and nothing else.
  712. ``util`` modules renamed to ``utils``
  713. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  714. The following instances of ``util.py`` in the Django codebase have been renamed
  715. to ``utils.py`` in an effort to unify all util and utils references:
  716. * ``django.contrib.admin.util``
  717. * ``django.contrib.gis.db.backends.util``
  718. * ``django.db.backends.util``
  719. * ``django.forms.util``
  720. ``get_formsets`` method on ``ModelAdmin``
  721. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  722. ``ModelAdmin.get_formsets`` has been deprecated in favor of the new
  723. :meth:`~django.contrib.admin.ModelAdmin.get_formsets_with_inlines`, in order to
  724. better handle the case of selecting showing inlines on a ``ModelAdmin``.
  725. ``IPAddressField``
  726. ~~~~~~~~~~~~~~~~~~
  727. The :class:`django.db.models.IPAddressField` and
  728. :class:`django.forms.IPAddressField` fields have been deprecated in favor of
  729. :class:`django.db.models.GenericIPAddressField` and
  730. :class:`django.forms.GenericIPAddressField`.
  731. ``BaseMemcachedCache._get_memcache_timeout`` method
  732. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  733. The ``BaseMemcachedCache._get_memcache_timeout()`` method has been renamed to
  734. ``get_backend_timeout()``. Despite being a private API, it will go through the
  735. normal deprecation.
  736. Natural key serialization options
  737. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  738. The ``--natural`` and ``-n`` options for :djadmin:`dumpdata` have been
  739. deprecated. Use :djadminopt:`--natural-foreign` instead.
  740. Similarly, the ``use_natural_keys`` argument for ``serializers.serialize()``
  741. has been deprecated. Use ``use_natural_foreign_keys`` instead.
  742. Merging of ``POST`` and ``GET`` arguments into ``WSGIRequest.REQUEST``
  743. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  744. It was already strongly suggested that you use ``GET`` and ``POST`` instead of
  745. ``REQUEST``, because the former are more explicit. The property ``REQUEST`` is
  746. deprecated and will be removed in Django 1.9.
  747. ``django.utils.datastructures.MergeDict`` class
  748. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  749. ``MergeDict`` exists primarily to support merging ``POST`` and ``GET``
  750. arguments into a ``REQUEST`` property on ``WSGIRequest``. To merge
  751. dictionaries, use ``dict.update()`` instead. The class ``MergeDict`` is
  752. deprecated and will be removed in Django 1.9.
  753. Language codes ``zh-cn``, ``zh-tw`` and ``fy-nl``
  754. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  755. The currently used language codes for Simplified Chinese ``zh-cn``,
  756. Traditional Chinese ``zh-tw`` and (Western) Frysian ``fy-nl`` are deprecated
  757. and should be replaced by the language codes ``zh-hans``, ``zh-hant`` and
  758. ``fy`` respectively. If you use these language codes, you should rename the
  759. locale directories and update your settings to reflect these changes. The
  760. deprecated language codes will be removed in Django 1.9.
  761. ``django.utils.functional.memoize`` function
  762. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  763. The function ``memoize`` is deprecated and should be replaced by the
  764. ``functools.lru_cache`` decorator (available from Python 3.2 onwards).
  765. Django ships a backport of this decorator for older Python versions and it's
  766. available at ``django.utils.lru_cache.lru_cache``. The deprecated function will
  767. be removed in Django 1.9.
  768. Geo Sitemaps
  769. ~~~~~~~~~~~~
  770. Google has retired support for the Geo Sitemaps format. Hence Django support
  771. for Geo Sitemaps is deprecated and will be removed in Django 1.8.
  772. Passing callable arguments to queryset methods
  773. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  774. Callable arguments for querysets were an undocumented feature that was
  775. unreliable. It's been deprecated and will be removed in Django 1.9.
  776. Callable arguments were evaluated when a queryset was constructed rather than
  777. when it was evaluated, thus this feature didn't offer any benefit compared to
  778. evaluating arguments before passing them to queryset and created confusion that
  779. the arguments may have been evaluated at query time.
  780. ``ADMIN_FOR`` setting
  781. ~~~~~~~~~~~~~~~~~~~~~
  782. The ``ADMIN_FOR`` feature, part of the admindocs, has been removed. You can
  783. remove the setting from your configuration at your convenience.