1.5.txt 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. ============================================
  2. Django 1.5 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. These release notes cover the `new features`_, as well
  5. as some `backwards incompatible changes`_ you'll want to be aware of
  6. when upgrading from Django 1.4 or older versions. We've also dropped some
  7. features, which are detailed in :doc:`our deprecation plan
  8. </internals/deprecation>`, and we've `begun the deprecation process for some
  9. features`_.
  10. .. _`new features`: `What's new in Django 1.5`_
  11. .. _`backwards incompatible changes`: `Backwards incompatible changes in 1.5`_
  12. .. _`begun the deprecation process for some features`: `Features deprecated in 1.5`_
  13. Python compatibility
  14. ====================
  15. Django 1.5 has dropped support for Python 2.5. Python 2.6.5 is now the minimum
  16. required Python version. Django is tested and supported on Python 2.6 and
  17. 2.7.
  18. This change should affect only a small number of Django users, as most
  19. operating-system vendors today are shipping Python 2.6 or newer as their default
  20. version. If you're still using Python 2.5, however, you'll need to stick to
  21. Django 1.4 until you can upgrade your Python version. Per :doc:`our support policy
  22. </internals/release-process>`, Django 1.4 will continue to receive security
  23. support until the release of Django 1.6.
  24. Django 1.5 does not run on a Jython final release, because Jython's latest release
  25. doesn't currently support Python 2.6. However, Jython currently does offer an alpha
  26. release featuring 2.7 support.
  27. What's new in Django 1.5
  28. ========================
  29. Configurable User model
  30. ~~~~~~~~~~~~~~~~~~~~~~~
  31. In Django 1.5, you can now use your own model as the store for user-related
  32. data. If your project needs a username with more than 30 characters, or if
  33. you want to store usernames in a format other than first name/last name, or
  34. you want to put custom profile information onto your User object, you can
  35. now do so.
  36. If you have a third-party reusable application that references the User model,
  37. you may need to make some changes to the way you reference User instances. You
  38. should also document any specific features of the User model that your
  39. application relies upon.
  40. See the :ref:`documentation on custom User models <auth-custom-user>` for
  41. more details.
  42. Support for saving a subset of model's fields
  43. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  44. The method :meth:`Model.save() <django.db.models.Model.save()>` has a new
  45. keyword argument ``update_fields``. By using this argument it is possible to
  46. save only a select list of model's fields. This can be useful for performance
  47. reasons or when trying to avoid overwriting concurrent changes.
  48. Deferred instances (those loaded by .only() or .defer()) will automatically
  49. save just the loaded fields. If any field is set manually after load, that
  50. field will also get updated on save.
  51. See the :meth:`Model.save() <django.db.models.Model.save()>` documentation for
  52. more details.
  53. Caching of related model instances
  54. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  55. When traversing relations, the ORM will avoid re-fetching objects that were
  56. previously loaded. For example, with the tutorial's models::
  57. >>> first_poll = Poll.objects.all()[0]
  58. >>> first_choice = first_poll.choice_set.all()[0]
  59. >>> first_choice.poll is first_poll
  60. True
  61. In Django 1.5, the third line no longer triggers a new SQL query to fetch
  62. ``first_choice.poll``; it was set by the second line.
  63. For one-to-one relationships, both sides can be cached. For many-to-one
  64. relationships, only the single side of the relationship can be cached. This
  65. is particularly helpful in combination with ``prefetch_related``.
  66. Explicit support for streaming responses
  67. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68. Before Django 1.5, it was possible to create a streaming response by passing
  69. an iterator to :class:`~django.http.HttpResponse`. But this was unreliable:
  70. any middleware that accessed the :attr:`~django.http.HttpResponse.content`
  71. attribute would consume the iterator prematurely.
  72. You can now explicitly generate a streaming response with the new
  73. :class:`~django.http.StreamingHttpResponse` class. This class exposes a
  74. :class:`~django.http.StreamingHttpResponse.streaming_content` attribute which
  75. is an iterator.
  76. Since :class:`~django.http.StreamingHttpResponse` does not have a ``content``
  77. attribute, middleware that need access to the response content must test for
  78. streaming responses and behave accordingly. See :ref:`response-middleware` for
  79. more information.
  80. ``{% verbatim %}`` template tag
  81. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  82. To make it easier to deal with javascript templates which collide with Django's
  83. syntax, you can now use the :ttag:`verbatim` block tag to avoid parsing the
  84. tag's content.
  85. Retrieval of ``ContentType`` instances associated with proxy models
  86. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  87. The methods :meth:`ContentTypeManager.get_for_model() <django.contrib.contenttypes.models.ContentTypeManager.get_for_model()>`
  88. and :meth:`ContentTypeManager.get_for_models() <django.contrib.contenttypes.models.ContentTypeManager.get_for_models()>`
  89. have a new keyword argument – respectively ``for_concrete_model`` and ``for_concrete_models``.
  90. By passing ``False`` using this argument it is now possible to retreive the
  91. :class:`ContentType <django.contrib.contenttypes.models.ContentType>`
  92. associated with proxy models.
  93. New ``view`` variable in class-based views context
  94. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  95. In all :doc:`generic class-based views </topics/class-based-views/index>`
  96. (or any class-based view inheriting from ``ContextMixin``), the context dictionary
  97. contains a ``view`` variable that points to the ``View`` instance.
  98. GeoDjango
  99. ~~~~~~~~~
  100. * :class:`~django.contrib.gis.geos.LineString` and
  101. :class:`~django.contrib.gis.geos.MultiLineString` GEOS objects now support the
  102. :meth:`~django.contrib.gis.geos.GEOSGeometry.interpolate()` and
  103. :meth:`~django.contrib.gis.geos.GEOSGeometry.project()` methods
  104. (so-called linear referencing).
  105. * The wkb and hex properties of `GEOSGeometry` objects preserve the Z dimension.
  106. * Support for PostGIS 2.0 has been added and support for GDAL < 1.5 has been
  107. dropped.
  108. Minor features
  109. ~~~~~~~~~~~~~~
  110. Django 1.5 also includes several smaller improvements worth noting:
  111. * The template engine now interprets ``True``, ``False`` and ``None`` as the
  112. corresponding Python objects.
  113. * :mod:`django.utils.timezone` provides a helper for converting aware
  114. datetimes between time zones. See :func:`~django.utils.timezone.localtime`.
  115. * The generic views support OPTIONS requests.
  116. * Management commands do not raise ``SystemExit`` any more when called by code
  117. from :ref:`call_command <call-command>`. Any exception raised by the command
  118. (mostly :ref:`CommandError <ref-command-exceptions>`) is propagated.
  119. * The dumpdata management command outputs one row at a time, preventing
  120. out-of-memory errors when dumping large datasets.
  121. * In the localflavor for Canada, "pq" was added to the acceptable codes for
  122. Quebec. It's an old abbreviation.
  123. * The :ref:`receiver <connecting-receiver-functions>` decorator is now able to
  124. connect to more than one signal by supplying a list of signals.
  125. * In the admin, you can now filter users by groups which they are members of.
  126. * :meth:`QuerySet.bulk_create()
  127. <django.db.models.query.QuerySet.bulk_create>` now has a batch_size
  128. argument. By default the batch_size is unlimited except for SQLite where
  129. single batch is limited so that 999 parameters per query isn't exceeded.
  130. * The :setting:`LOGIN_URL` and :setting:`LOGIN_REDIRECT_URL` settings now also
  131. accept view function names and
  132. :ref:`named URL patterns <naming-url-patterns>`. This allows you to reduce
  133. configuration duplication. More information can be found in the
  134. :func:`~django.contrib.auth.decorators.login_required` documentation.
  135. * Django now provides a mod_wsgi :doc:`auth handler
  136. </howto/deployment/wsgi/apache-auth>`.
  137. * The :meth:`QuerySet.delete() <django.db.models.query.QuerySet.delete>`
  138. and :meth:`Model.delete() <django.db.models.Model.delete()>` can now take
  139. fast-path in some cases. The fast-path allows for less queries and less
  140. objects fetched into memory. See :meth:`QuerySet.delete()
  141. <django.db.models.query.QuerySet.delete>` for details.
  142. * An instance of :class:`~django.core.urlresolvers.ResolverMatch` is stored on
  143. the request as ``resolver_match``.
  144. * By default, all logging messages reaching the `django` logger when
  145. :setting:`DEBUG` is `True` are sent to the console (unless you redefine the
  146. logger in your :setting:`LOGGING` setting).
  147. * When using :class:`~django.template.RequestContext`, it is now possible to
  148. look up permissions by using ``{% if 'someapp.someperm' in perms %}``
  149. in templates.
  150. * It's not required any more to have ``404.html`` and ``500.html`` templates in
  151. the root templates directory. Django will output some basic error messages for
  152. both situations when those templates are not found. Of course, it's still
  153. recommended as good practice to provide those templates in order to present
  154. pretty error pages to the user.
  155. * :mod:`django.contrib.auth` provides a new signal that is emitted
  156. whenever a user fails to login successfully. See
  157. :data:`~django.contrib.auth.signals.user_login_failed`
  158. * The loaddata management command now supports an `ignorenonexistent` option to
  159. ignore data for fields that no longer exist.
  160. * :meth:`~django.test.SimpleTestCase.assertXMLEqual` and
  161. :meth:`~django.test.SimpleTestCase.assertXMLNotEqual` new assertions allow
  162. you to test equality for XML content at a semantic level, without caring for
  163. syntax differences (spaces, attribute order, etc.).
  164. Backwards incompatible changes in 1.5
  165. =====================================
  166. .. warning::
  167. In addition to the changes outlined in this section, be sure to review the
  168. :doc:`deprecation plan </internals/deprecation>` for any features that
  169. have been removed. If you haven't updated your code within the
  170. deprecation timeline for a given feature, its removal may appear as a
  171. backwards incompatible change.
  172. Context in year archive class-based views
  173. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  174. For consistency with the other date-based generic views,
  175. :class:`~django.views.generic.dates.YearArchiveView` now passes ``year`` in
  176. the context as a :class:`datetime.date` rather than a string. If you are
  177. using ``{{ year }}`` in your templates, you must replace it with ``{{
  178. year|date:"Y" }}``.
  179. ``next_year`` and ``previous_year`` were also added in the context. They are
  180. calculated according to ``allow_empty`` and ``allow_future``.
  181. Context in year and month archive class-based views
  182. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  183. :class:`~django.views.generic.dates.YearArchiveView` and
  184. :class:`~django.views.generic.dates.MonthArchiveView` were documented to
  185. provide a ``date_list`` sorted in ascending order in the context, like their
  186. function-based predecessors, but it actually was in descending order. In 1.5,
  187. the documented order was restored. You may want to add (or remove) the
  188. ``reversed`` keyword when you're iterating on ``date_list`` in a template::
  189. {% for date in date_list reversed %}
  190. :class:`~django.views.generic.dates.ArchiveIndexView` still provides a
  191. ``date_list`` in descending order.
  192. Context in TemplateView
  193. ~~~~~~~~~~~~~~~~~~~~~~~
  194. For consistency with the design of the other generic views,
  195. :class:`~django.views.generic.base.TemplateView` no longer passes a ``params``
  196. dictionary into the context, instead passing the variables from the URLconf
  197. directly into the context.
  198. Non-form data in HTTP requests
  199. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  200. :attr:`request.POST <django.http.HttpRequest.POST>` will no longer include data
  201. posted via HTTP requests with non form-specific content-types in the header.
  202. In prior versions, data posted with content-types other than
  203. ``multipart/form-data`` or ``application/x-www-form-urlencoded`` would still
  204. end up represented in the :attr:`request.POST <django.http.HttpRequest.POST>`
  205. attribute. Developers wishing to access the raw POST data for these cases,
  206. should use the :attr:`request.body <django.http.HttpRequest.body>` attribute
  207. instead.
  208. OPTIONS, PUT and DELETE requests in the test client
  209. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  210. Unlike GET and POST, these HTTP methods aren't implemented by web browsers.
  211. Rather, they're used in APIs, which transfer data in various formats such as
  212. JSON or XML. Since such requests may contain arbitrary data, Django doesn't
  213. attempt to decode their body.
  214. However, the test client used to build a query string for OPTIONS and DELETE
  215. requests like for GET, and a request body for PUT requests like for POST. This
  216. encoding was arbitrary and inconsistent with Django's behavior when it
  217. receives the requests, so it was removed in Django 1.5.
  218. If you were using the ``data`` parameter in an OPTIONS or a DELETE request,
  219. you must convert it to a query string and append it to the ``path`` parameter.
  220. If you were using the ``data`` parameter in a PUT request without a
  221. ``content_type``, you must encode your data before passing it to the test
  222. client and set the ``content_type`` argument.
  223. .. _simplejson-incompatibilities:
  224. System version of :mod:`simplejson` no longer used
  225. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226. :ref:`As explained below <simplejson-deprecation>`, Django 1.5 deprecates
  227. :mod:`django.utils.simplejson` in favor of Python 2.6's built-in :mod:`json`
  228. module. In theory, this change is harmless. Unfortunately, because of
  229. incompatibilities between versions of :mod:`simplejson`, it may trigger errors
  230. in some circumstances.
  231. JSON-related features in Django 1.4 always used :mod:`django.utils.simplejson`.
  232. This module was actually:
  233. - A system version of :mod:`simplejson`, if one was available (ie. ``import
  234. simplejson`` works), if it was more recent than Django's built-in copy or it
  235. had the C speedups, or
  236. - The :mod:`json` module from the standard library, if it was available (ie.
  237. Python 2.6 or greater), or
  238. - A built-in copy of version 2.0.7 of :mod:`simplejson`.
  239. In Django 1.5, those features use Python's :mod:`json` module, which is based
  240. on version 2.0.9 of :mod:`simplejson`.
  241. There are no known incompatibilities between Django's copy of version 2.0.7 and
  242. Python's copy of version 2.0.9. However, there are some incompatibilities
  243. between other versions of :mod:`simplejson`:
  244. - While the :mod:`simplejson` API is documented as always returning unicode
  245. strings, the optional C implementation can return a byte string. This was
  246. fixed in Python 2.7.
  247. - :class:`simplejson.JSONEncoder` gained a ``namedtuple_as_object`` keyword
  248. argument in version 2.2.
  249. More information on these incompatibilities is available in `ticket #18023`_.
  250. The net result is that, if you have installed :mod:`simplejson` and your code
  251. uses Django's serialization internals directly -- for instance
  252. :class:`django.core.serializers.json.DjangoJSONEncoder`, the switch from
  253. :mod:`simplejson` to :mod:`json` could break your code. (In general, changes to
  254. internals aren't documented; we're making an exception here.)
  255. At this point, the maintainers of Django believe that using :mod:`json` from
  256. the standard library offers the strongest guarantee of backwards-compatibility.
  257. They recommend to use it from now on.
  258. .. _ticket #18023: https://code.djangoproject.com/ticket/18023#comment:10
  259. String types of hasher method parameters
  260. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  261. If you have written a :ref:`custom password hasher <auth_password_storage>`,
  262. your ``encode()``, ``verify()`` or ``safe_summary()`` methods should accept
  263. Unicode parameters (``password``, ``salt`` or ``encoded``). If any of the
  264. hashing methods need byte strings, you can use the
  265. :func:`~django.utils.encoding.force_bytes` utility to encode the strings.
  266. Validation of previous_page_number and next_page_number
  267. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  268. When using :doc:`object pagination </topics/pagination>`,
  269. the ``previous_page_number()`` and ``next_page_number()`` methods of the
  270. :class:`~django.core.paginator.Page` object did not check if the returned
  271. number was inside the existing page range.
  272. It does check it now and raises an :exc:`InvalidPage` exception when the number
  273. is either too low or too high.
  274. Behavior of autocommit database option on PostgreSQL changed
  275. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  276. PostgreSQL's autocommit option didn't work as advertised previously. It did
  277. work for single transaction block, but after the first block was left the
  278. autocommit behavior was never restored. This bug is now fixed in 1.5. While
  279. this is only a bug fix, it is worth checking your applications behavior if
  280. you are using PostgreSQL together with the autocommit option.
  281. Session not saved on 500 responses
  282. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283. Django's session middleware will skip saving the session data if the
  284. response's status code is 500.
  285. Email checks on failed admin login
  286. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  287. Prior to Django 1.5, if you attempted to log into the admin interface and
  288. mistakenly used your email address instead of your username, the admin
  289. interface would provide a warning advising that your email address was
  290. not your username. In Django 1.5, the introduction of
  291. :ref:`custom User models <auth-custom-user>` has required the removal of this
  292. warning. This doesn't change the login behavior of the admin site; it only
  293. affects the warning message that is displayed under one particular mode of
  294. login failure.
  295. Changes in tests execution
  296. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  297. Some changes have been introduced in the execution of tests that might be
  298. backward-incompatible for some testing setups:
  299. Database flushing in ``django.test.TransactionTestCase``
  300. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  301. Previously, the test database was truncated *before* each test run in a
  302. :class:`~django.test.TransactionTestCase`.
  303. In order to be able to run unit tests in any order and to make sure they are
  304. always isolated from each other, :class:`~django.test.TransactionTestCase` will
  305. now reset the database *after* each test run instead.
  306. No more implict DB sequences reset
  307. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  308. :class:`~django.test.TransactionTestCase` tests used to reset primary key
  309. sequences automatically together with the database flushing actions described
  310. above.
  311. This has been changed so no sequences are implicitly reset. This can cause
  312. :class:`~django.test.TransactionTestCase` tests that depend on hard-coded
  313. primary key values to break.
  314. The new :attr:`~django.test.TransactionTestCase.reset_sequences` attribute can
  315. be used to force the old behavior for :class:`~django.test.TransactionTestCase`
  316. that might need it.
  317. Ordering of tests
  318. ^^^^^^^^^^^^^^^^^
  319. In order to make sure all ``TestCase`` code starts with a clean database,
  320. tests are now executed in the following order:
  321. * First, all unittests (including :class:`unittest.TestCase`,
  322. :class:`~django.test.SimpleTestCase`, :class:`~django.test.TestCase` and
  323. :class:`~django.test.TransactionTestCase`) are run with no particular ordering
  324. guaranteed nor enforced among them.
  325. * Then any other tests (e.g. doctests) that may alter the database without
  326. restoring it to its original state are run.
  327. This should not cause any problems unless you have existing doctests which
  328. assume a :class:`~django.test.TransactionTestCase` executed earlier left some
  329. database state behind or unit tests that rely on some form of state being
  330. preserved after the execution of other tests. Such tests are already very
  331. fragile, and must now be changed to be able to run independently.
  332. `cleaned_data` dictionary kept for invalid forms
  333. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  334. The :attr:`~django.forms.Form.cleaned_data` dictionary is now always present
  335. after form validation. When the form doesn't validate, it contains only the
  336. fields that passed validation. You should test the success of the validation
  337. with the :meth:`~django.forms.Form.is_valid()` method and not with the
  338. presence or absence of the :attr:`~django.forms.Form.cleaned_data` attribute
  339. on the form.
  340. Miscellaneous
  341. ~~~~~~~~~~~~~
  342. * :class:`django.forms.ModelMultipleChoiceField` now returns an empty
  343. ``QuerySet`` as the empty value instead of an empty list.
  344. * :func:`~django.utils.http.int_to_base36` properly raises a :exc:`TypeError`
  345. instead of :exc:`ValueError` for non-integer inputs.
  346. * The ``slugify`` template filter is now available as a standard python
  347. function at :func:`django.utils.text.slugify`. Similarly, ``remove_tags`` is
  348. available at :func:`django.utils.html.remove_tags`.
  349. * Uploaded files are no longer created as executable by default. If you need
  350. them to be executeable change :setting:`FILE_UPLOAD_PERMISSIONS` to your
  351. needs. The new default value is `0666` (octal) and the current umask value
  352. is first masked out.
  353. * The :ref:`F() expressions <query-expressions>` supported bitwise operators by
  354. ``&`` and ``|``. These operators are now available using ``.bitand()`` and
  355. ``.bitor()`` instead. The removal of ``&`` and ``|`` was done to be consistent with
  356. :ref:`Q() expressions <complex-lookups-with-q>` and ``QuerySet`` combining where
  357. the operators are used as boolean AND and OR operators.
  358. * The :ttag:`csrf_token` template tag is no longer enclosed in a div. If you need
  359. HTML validation against pre-HTML5 Strict DTDs, you should add a div around it
  360. in your pages.
  361. Features deprecated in 1.5
  362. ==========================
  363. .. _simplejson-deprecation:
  364. ``django.utils.simplejson``
  365. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  366. Since Django 1.5 drops support for Python 2.5, we can now rely on the
  367. :mod:`json` module being available in Python's standard library, so we've
  368. removed our own copy of :mod:`simplejson`. You should now import :mod:`json`
  369. instead :mod:`django.utils.simplejson`.
  370. Unfortunately, this change might have unwanted side-effects, because of
  371. incompatibilities between versions of :mod:`simplejson` -- see the
  372. :ref:`backwards-incompatible changes <simplejson-incompatibilities>` section.
  373. If you rely on features added to :mod:`simplejson` after it became Python's
  374. :mod:`json`, you should import :mod:`simplejson` explicitly.
  375. ``itercompat.product``
  376. ~~~~~~~~~~~~~~~~~~~~~~
  377. The :func:`~django.utils.itercompat.product` function has been deprecated. Use
  378. the built-in :func:`itertools.product` instead.
  379. ``django.utils.encoding.StrAndUnicode``
  380. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  381. The :class:`~django.utils.encoding.StrAndUnicode` mix-in has been deprecated.
  382. Define a ``__str__`` method and apply the
  383. :func:`~django.utils.encoding.python_2_unicode_compatible` decorator instead.
  384. ``django.utils.markup``
  385. ~~~~~~~~~~~~~~~~~~~~~~~
  386. The markup contrib module has been deprecated and will follow an accelerated
  387. deprecation schedule. Direct use of python markup libraries or 3rd party tag
  388. libraries is preferred to Django maintaining this functionality in the
  389. framework.
  390. :setting:`AUTH_PROFILE_MODULE`
  391. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  392. With the introduction of :ref:`custom User models <auth-custom-user>`, there is
  393. no longer any need for a built-in mechanism to store user profile data.
  394. You can still define user profiles models that have a one-to-one relation with
  395. the User model - in fact, for many applications needing to associate data with
  396. a User account, this will be an appropriate design pattern to follow. However,
  397. the :setting:`AUTH_PROFILE_MODULE` setting, and the
  398. :meth:`~django.contrib.auth.models.User.get_profile()` method for accessing
  399. the user profile model, should not be used any longer.