1.2.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. =========================
  2. Wagtail 1.2 release notes
  3. =========================
  4. *November 12, 2015*
  5. .. contents::
  6. :local:
  7. :depth: 1
  8. What's new
  9. ==========
  10. Site settings module
  11. ~~~~~~~~~~~~~~~~~~~~
  12. Wagtail now includes a contrib module (previously available as the `wagtailsettings <https://pypi.python.org/pypi/wagtailsettings/>`_ package) to allow administrators to edit site-specific settings.
  13. See: :doc:`/reference/contrib/settings`
  14. Jinja2 support
  15. ~~~~~~~~~~~~~~
  16. The core templatetags (``pageurl``, ``slugurl``, ``image``, ``richtext`` and ``wagtailuserbar``) are now compatible with Jinja2 so it's now possible to use Jinja2 as the template engine for your Wagtail site.
  17. Note that the variable name ``self`` is reserved in Jinja2, and so Wagtail now provides alternative variable names where ``self`` was previously used: ``page`` to refer to page objects, and ``value`` to refer to StreamField blocks. All code examples in this documentation have now been updated to use the new variable names, for compatibility with Jinja2; however, users of the default Django template engine can continue to use ``self``.
  18. See: :doc:`/reference/jinja2`
  19. Site-specific redirects
  20. ~~~~~~~~~~~~~~~~~~~~~~~
  21. You can now create redirects for a particular site using the admin interface.
  22. Search API improvements
  23. ~~~~~~~~~~~~~~~~~~~~~~~
  24. Wagtail's image and document models now provide a ``search`` method on their QuerySets, making it easy to perform searches on filtered data sets. In addition, search methods now accept two new keyword arguments:
  25. * ``operator``, to determine whether multiple search terms will be treated as 'or' (any term may match) or 'and' (all terms must match);
  26. * ``order_by_relevance``, set to True (the default) to order by relevance or False to preserve the QuerySet's original ordering.
  27. See: :ref:`wagtailsearch_searching`
  28. ``max_num`` and ``min_num`` parameters on inline panels
  29. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  30. Inline panels now accept the optional parameters ``max_num`` and ``min_num``, to specify the maximum / minimum number of child items that must exist for the page to be valid.
  31. See: :ref:`inline_panels`
  32. ``get_context`` on StreamField blocks
  33. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. StreamField blocks now :ref:`provide a get_context method <streamfield_get_context>` that can be overridden to pass additional variables to the block's template.
  35. Browsable API
  36. ~~~~~~~~~~~~~
  37. The Wagtail API now incorporates the browsable front-end provided by Django REST Framework. Note that this must be enabled by adding ``'rest_framework'`` to your project's ``INSTALLED_APPS`` setting.
  38. Python 3.5 support
  39. ~~~~~~~~~~~~~~~~~~
  40. Wagtail now supports Python 3.5 when run in conjunction with Django 1.8.6 or later.
  41. Minor features
  42. ~~~~~~~~~~~~~~
  43. * WagtailRedirectMiddleware can now ignore the query string if no redirect exactly matches it
  44. * Order of URL parameters now ignored by redirect middleware
  45. * Added SQL Server compatibility to image migration
  46. * Added ``class`` attributes to Wagtail rich text editor buttons to aid custom styling
  47. * Simplified body_class in default homepage template
  48. * page_published signal now called with the revision object that was published
  49. * Added a favicon to the admin interface, customizable by overriding the ``branding_favicon`` block (see :ref:`custom_branding`).
  50. * Added spinner animations to long-running form submissions
  51. * The EMBEDLY_KEY setting has been renamed to WAGTAILEMBEDS_EMBEDLY_KEY
  52. * StreamField blocks are now added automatically, without showing the block types menu, if only one block type exists (Alex Gleason)
  53. * The ``first_published_at`` and ``latest_revision_created_at`` fields on page models are now available as filter fields on search queries
  54. * Wagtail admin now standardizes on a single thumbnail image size, to reduce the overhead of creating multiple renditions
  55. * Rich text fields now strip out HTML comments
  56. * Page editor form now sets ``enctype="multipart/form-data"`` as appropriate, allowing FileField to be used on page models (Petr Vacha)
  57. * Explorer navigation menu on an empty page tree now takes you to the root level, rather than doing nothing
  58. * Added animation and fixed display issues when focusing a rich text field (Alex Gleason)
  59. * Added a system check to warn if Pillow is compiled without JPEG / PNG support
  60. * Page chooser now prevents users from selecting the root node where this would be invalid
  61. * New translations for Dutch (Netherlands), Georgian, Swedish and Turkish (Turkey)
  62. Bug fixes
  63. ~~~~~~~~~
  64. * Page slugs are no longer auto-updated from the page title if the page is already published
  65. * Deleting a page permission from the groups admin UI does not immediately submit the form
  66. * Wagtail userbar is shown on pages that do not pass a ``page`` variable to the template (e.g. because they override the ``serve`` method)
  67. * ``request.site`` now set correctly on page preview when the page is not in the default site
  68. * Project template no longer raises a deprecation warning (Maximilian Stauss)
  69. * ``PageManager.sibling_of(page)`` and ``PageManager.not_sibling_of(page)`` now default to inclusive (i.e. ``page`` is considered a sibling of itself), for consistency with other sibling methods
  70. * The "view live" button displayed after publishing a page now correctly reflects any changes made to the page slug (Ryan Pineo)
  71. * API endpoints now accept and ignore the ``_`` query parameter used by jQuery for cache-busting
  72. * Page slugs are no longer cut off when Unicode characters are expanded into multiple characters (Sævar Öfjörð Magnússon)
  73. * Searching a specific page model while filtering it by either ID or tree position no longer raises an error (Ashia Zawaduk)
  74. * Scrolling an over-long explorer menu no longer causes white background to show through (Alex Gleason)
  75. * Removed jitter when hovering over StreamField blocks (Alex Gleason)
  76. * Non-ASCII email addresses no longer throw errors when generating Gravatar URLs (Denis Voskvitsov, Kyle Stratis)
  77. * Dropdown for ``ForeignKey`` s are now styled consistently (Ashia Zawaduk)
  78. * Date choosers now appear on top of StreamField menus (Sergey Nikitin)
  79. * Fixed a migration error that was raised when block-updating from 0.8 to 1.1+
  80. * :meth:`wagtail.models.Page.copy() <wagtail.models.Page.copy>` no longer breaks on models with a ``ClusterTaggableManager`` or ``ManyToManyField``
  81. * Validation errors when inserting an embed into a rich text area are now reported back to the editor
  82. Upgrade considerations
  83. ======================
  84. ``PageManager.sibling_of(page)`` and ``PageManager.not_sibling_of(page)`` have changed behaviour
  85. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86. In previous versions of Wagtail, the ``sibling_of`` and ``not_sibling_of`` methods behaved inconsistently depending on whether they were called on a manager (e.g. ``Page.objects.sibling_of(some_page)`` or ``EventPage.objects.sibling_of(some_page)``) or a QuerySet (e.g. ``Page.objects.all().sibling_of(some_page)`` or ``EventPage.objects.live().sibling_of(some_page)``).
  87. Previously, the manager methods behaved as *exclusive* by default; that is, they did not count the passed-in page object as a sibling of itself:
  88. .. code-block:: python
  89. >>> event_1 = EventPage.objects.get(title='Event 1')
  90. >>> EventPage.objects.sibling_of(event_1)
  91. [<EventPage: Event 2>] # OLD behavior: Event 1 is not considered a sibling of itself
  92. This has now been changed to be *inclusive* by default; that is, the page is counted as a sibling of itself:
  93. .. code-block:: python
  94. >>> event_1 = EventPage.objects.get(title='Event 1')
  95. >>> EventPage.objects.sibling_of(event_1)
  96. [<EventPage: Event 1>, <EventPage: Event 2>] # NEW behavior: Event 1 is considered a sibling of itself
  97. If the call to ``sibling_of`` or ``not_sibling_of`` is chained after another QuerySet method - such as ``all()``, ``filter()`` or ``live()`` - behaviour is unchanged; this behaves as *inclusive*, as it did in previous versions:
  98. .. code-block:: python
  99. >>> event_1 = EventPage.objects.get(title='Event 1')
  100. >>> EventPage.objects.all().sibling_of(event_1)
  101. [<EventPage: Event 1>, <EventPage: Event 2>] # OLD and NEW behaviour
  102. If your project includes queries that rely on the old (exclusive) behavior, this behavior can be restored by adding the keyword argument ``inclusive=False``:
  103. .. code-block:: python
  104. >>> event_1 = EventPage.objects.get(title='Event 1')
  105. >>> EventPage.objects.sibling_of(event_1, inclusive=False)
  106. [<EventPage: Event 2>] # passing inclusive=False restores the OLD behaviour
  107. ``Image.search`` and ``Document.search`` methods are deprecated
  108. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  109. The ``Image.search`` and ``Document.search`` methods have been deprecated in favor of the new QuerySet-based search mechanism - see :ref:`wagtailsearch_images_documents_custom_models`. Code using the old ``search`` methods should be updated to search on QuerySets instead; for example:
  110. .. code-block:: python
  111. Image.search("Hello", filters={'uploaded_by_user': user})
  112. can be rewritten as:
  113. .. code-block:: python
  114. Image.objects.filter(uploaded_by_user=user).search("Hello")
  115. Wagtail API requires adding ``rest_framework`` to INSTALLED_APPS
  116. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  117. If you have the Wagtail API (``wagtail.contrib.wagtailapi``) enabled, you must now add ``'rest_framework'`` to your project's ``INSTALLED_APPS`` setting. In the current version the API will continue to function without this app, but the browsable front-end will not be available; this ability will be dropped in a future release.
  118. `Page.get_latest_revision_as_page() <wagtail.core.models.Page.get_latest_revision_as_page>` now returns live page object when there are no draft changes
  119. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  120. If you have any application code that makes direct updates to page data, at the model or database level, be aware that the way these edits are reflected in the page editor has changed.
  121. Previously, the ``get_latest_revision_as_page`` method - used by the page editor to return the current page revision for editing - always retrieved data from the page's revision history. Now, it will only do so if the page has unpublished changes (i.e. the page is in ``live + draft`` state) - pages that have received no draft edits since being published will return the page's live data instead.
  122. As a result, any changes made directly to a live page object will be immediately reflected in the editor without needing to update the latest revision record (but note, the old behavior is still used for pages in ``live + draft`` state).