2.5.rst 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. =========================
  2. Wagtail 2.5 release notes
  3. =========================
  4. .. contents::
  5. :local:
  6. :depth: 1
  7. What's new
  8. ==========
  9. Django 2.2 support
  10. ~~~~~~~~~~~~~~~~~~
  11. This release is compatible with Django 2.2. Compatibility fixes were contributed by Matt Westcott and Andy Babic.
  12. New Markdown shortcuts in rich text
  13. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. Wagtail’s rich text editor now supports using Markdown shortcuts for inline formatting:
  15. * ``**`` for bold
  16. * ``_`` for italic
  17. * ``~`` for strikethrough (if enabled)
  18. * ````` for code (if enabled)
  19. To learn other shortcuts, have a look at the `keyboard shortcuts <https://www.draftail.org/docs/keyboard-shortcuts>`_ reference.
  20. Other features
  21. ~~~~~~~~~~~~~~
  22. * Added support for customising EditHandler-based forms on a per-request basis (Bertrand Bordage)
  23. * Added more informative error message when ``|richtext`` filter is applied to a non-string value (mukesh5)
  24. * Automatic search indexing can now be disabled on a per-model basis via the ``search_auto_update`` attribute (Karl Hobley)
  25. * Improved diffing of StreamFields when comparing page revisions (Karl Hobley)
  26. * Highlight broken links to pages and missing documents in rich text (Brady Moe)
  27. * Preserve links when copy-pasting rich text content from Wagtail to other tools (Thibaud Colas)
  28. * Rich text to contentstate conversion now prioritises more specific rules, to accommodate ``<p>`` and ``<br>`` elements with attributes (Matt Westcott)
  29. * Added limit image upload size by number of pixels (Thomas Elliott)
  30. * Added ``manage.py wagtail_update_index`` alias to avoid clashes with ``update_index`` commands from other packages (Matt Westcott)
  31. * Renamed ``target_model`` argument on ``PageChooserBlock`` to ``page_type`` (Loic Teixeira)
  32. * ``edit_handler`` and ``panels`` can now be defined on a ``ModelAdmin`` definition (Thomas Kremmel)
  33. * Add Learn Wagtail to third-party tutorials in documentation (Matt Westcott)
  34. * Add a Django setting ``TAG_LIMIT`` to limit number of tags that can be added to any taggit model (Mani)
  35. * Added instructions on how to generate urls for ``ModelAdmin`` to documentation (LB (Ben Johnston), Andy Babic)
  36. * Added option to specify a fallback URL on ``{% pageurl %}`` (Arthur Holzner)
  37. * Add support for more rich text formats, disabled by default: ``blockquote``, ``superscript``, ``subscript``, ``strikethrough``, ``code`` (Md Arifin Ibne Matin)
  38. * Added ``max_count_per_parent`` option on page models to limit the number of pages of a given type that can be created under one parent page (Wesley van Lee)
  39. * ``StreamField`` field blocks now accept a ``validators`` argument (Tom Usher)
  40. * Added edit / delete buttons to snippet index and "don't delete" option to confirmation screen, for consistency with pages (Kevin Howbrook)
  41. * Added name attributes to all built-in page action menu items (LB (Ben Johnston))
  42. * Added validation on the filter string to the Jinja2 image template tag (Jonny Scholes)
  43. * Changed the pages reordering UI toggle to make it easier to find (Katie Locke, Thibaud Colas)
  44. * Added support for rich text link rewrite handlers for ``external`` and ``email`` links (Md Arifin Ibne Matin)
  45. * Clarify installation instructions in documentation, especially regarding virtual environments. (Naomi Morduch Toubman)
  46. Bug fixes
  47. ~~~~~~~~~
  48. * Set ``SERVER_PORT`` to 443 in ``Page.dummy_request()`` for HTTPS sites (Sergey Fedoseev)
  49. * Include port number in ``Host`` header of ``Page.dummy_request()`` (Sergey Fedoseev)
  50. * Validation error messages in ``InlinePanel`` no longer count towards ``max_num`` when disabling the 'add' button (Todd Dembrey, Thibaud Colas)
  51. * Rich text to contentstate conversion now ignores stray closing tags (frmdstryr)
  52. * Escape backslashes in ``postgres_search`` queries (Hammy Goonan)
  53. * Parent page link in page chooser search results no longer navigates away (Asanka Lihiniyagoda, Sævar Öfjörð Magnússon)
  54. * ``routablepageurl`` tag now correctly omits domain part when multiple sites exist at the same root (Gassan Gousseinov)
  55. * Added missing collection column specifier on document listing template (Sergey Fedoseev)
  56. * Page Copy will now also copy ParentalManyToMany field relations (LB (Ben Johnston))
  57. * Admin HTML header now includes correct language code (Matt Westcott)
  58. * Unclear error message when saving image after focal point edit (Hugo van den Berg)
  59. * Increase max length on ``Embed.thumbnail_url`` to 255 characters (Kevin Howbrook)
  60. * ``send_mail`` now correctly uses the ``html_message`` kwarg for HTML messages (Tiago Requeijo)
  61. * Page copying no longer allowed if page model has reached its ``max_count`` (Andy Babic)
  62. * Don't show page type on page chooser button when multiple types are allowed (Thijs Kramer)
  63. * Make sure page chooser search results correspond to the latest search by cancelling previous requests (Esper Kuijs)
  64. * Inform user when moving a page from one parent to another where there is an already existing page with the same slug (Casper Timmers)
  65. * User add/edit forms now support form widgets with JS/CSS media (Damian Grinwis)
  66. * Rich text processing now preserves non-breaking spaces instead of converting them to normal spaces (Wesley van Lee)
  67. * Prevent autocomplete dropdowns from appearing over date choosers on Chrome (Kevin Howbrook)
  68. * Prevent crash when logging HTTP errors on Cloudflare cache purging (Kevin Howbrook)
  69. * Prevent rich text editor crash when filtering copy-pasted content and the last block is to be removed, e.g. unsupported image (Thibaud Colas)
  70. * Removing rich text links / documents now also works when the text selection is backwards (Thibaud Colas)
  71. * Prevent the rich text editor from crashing when copy-paste filtering removes all of its content (Thibaud Colas)
  72. * Page chooser now respects custom ``get_admin_display_title`` methods on parent page and breadcrumb (Haydn Greatnews)
  73. * Added consistent whitespace around sortable table headings (Matt Westcott)
  74. * Moved locale names for Chinese (Simplified) and Chinese (Traditional) to ``zh_Hans`` and ``zh_Hant`` (Matt Westcott)
  75. Upgrade considerations
  76. ======================
  77. ``EditHandler.bind_to_model`` and ``EditHandler.bind_to_instance`` deprecated
  78. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  79. The internal ``EditHandler`` methods ``bind_to_model`` and ``bind_to_instance`` have been deprecated, in favour of a new combined ``bind_to`` method which accepts ``model``, ``instance``, ``request`` and ``form`` as optional keyword arguments. Any user code which calls ``EditHandler.bind_to_model(model)`` should be updated to use ``EditHandler.bind_to(model=model)`` instead; any user code which calls ``EditHandler.bind_to_instance(instance, request, form)`` should be updated to use ``EditHandler.bind_to(instance=instance, request=request, form=form)``.
  80. Changes to admin pagination helpers
  81. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  82. A number of changes have been made to pagination handling within the Wagtail admin; these are internal API changes, but may affect applications and third-party packages that add new paginated object listings, including chooser modals, to the admin. The ``paginate`` function in ``wagtail.utils.pagination`` has been deprecated in favour of the ``django.core.paginator.Paginator.get_page`` method introduced in Django 2.0 - a call such as:
  83. .. code-block:: python
  84. from wagtail.utils.pagination import paginate
  85. paginator, page = paginate(request, object_list, per_page=25)
  86. should be replaced with:
  87. .. code-block:: python
  88. from django.core.paginator import Paginator
  89. paginator = Paginator(object_list, per_page=25)
  90. page = paginator.get_page(request.GET.get('p'))
  91. Additionally, the ``is_ajax`` flag on the template ``wagtailadmin/shared/pagination_nav.html`` has been deprecated in favour of a new template ``wagtailadmin/shared/ajax_pagination_nav.html``:
  92. .. code-block:: html+django
  93. {% include "wagtailadmin/shared/pagination_nav.html" with items=page_obj is_ajax=1 %}
  94. should become:
  95. .. code-block:: html+django
  96. {% include "wagtailadmin/shared/ajax_pagination_nav.html" with items=page_obj %}
  97. New rich text formats
  98. ~~~~~~~~~~~~~~~~~~~~~
  99. Wagtail now has built-in support for new rich text formats, disabled by default:
  100. * ``blockquote``, using the ``blockquote`` Draft.js block type, saved as a ``<blockquote>`` tag.
  101. * ``superscript``, using the ``SUPERSCRIPT`` Draft.js inline style, saved as a ``<sup>`` tag.
  102. * ``subscript``, using the ``SUBSCRIPT`` Draft.js inline style, saved as a ``<sub>`` tag.
  103. * ``strikethrough``, using the ``STRIKETHROUGH`` Draft.js inline style, saved as a ``<s>`` tag.
  104. * ``code``, using the ``CODE`` Draft.js inline style, saved as a ``<code>`` tag.
  105. Projects already using those exact Draft.js type and HTML tag combinations can safely replace their feature definitions with the new built-ins. Projects that use the same feature identifier can keep their existing feature definitions as overrides. Finally, if the Draft.js types / HTML tags are used but with a different combination, do not enable the new feature definitions to avoid conflicts in storage or editor behavior.
  106. ``register_link_type`` and ``register_embed_type`` methods for rich text tag rewriting have changed
  107. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  108. The ``FeatureRegistry.register_link_type`` and ``FeatureRegistry.register_embed_type`` methods, which define how links and embedded media in rich text are converted to HTML, now accept a handler class. Previously, they were passed an identifier string and a rewrite function. For details of updating your code to the new convention, see :ref:`rich_text_rewrite_handlers`.
  109. Chinese language locales changed to ``zh_Hans`` and ``zh_Hant``
  110. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111. The translations for Chinese (Simplified) and Chinese (Traditional) are now available under the locale names ``zh_Hans`` and ``zh_Hant`` respectively, rather than ``zh_CN`` and ``zh_TW``. Projects that currently use the old names for the ``LANGUAGE_CODE`` setting may need to update the settings file to use the new names.