wagtail/docs/releases/1.2.rst

129 wiersze
6.5 KiB
ReStructuredText
Czysty Zwykły widok Historia

2015-09-09 14:23:29 +00:00
==========================================
Wagtail 1.2 release notes - IN DEVELOPMENT
==========================================
.. contents::
:local:
:depth: 1
What's new
==========
2015-10-06 21:21:25 +00:00
Jinja2 support
~~~~~~~~~~~~~~
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.
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``.
2015-10-06 21:21:25 +00:00
See: :doc:`/advanced_topics/jinja2`
2015-10-12 21:13:34 +00:00
Search API improvements
~~~~~~~~~~~~~~~~~~~~~~~
2015-10-13 18:32:29 +00:00
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:
* ``operator``, to determine whether multiple search terms will be treated as 'or' (any term may match) or 'and' (all terms must match);
* ``order_by_relevance``, set to True (the default) to order by relevance or False to preserve the QuerySet's original ordering.
2015-10-12 21:13:34 +00:00
See: :ref:`wagtailsearch_searching`
2015-10-09 15:41:32 +00:00
``max_num`` and ``min_num`` parameters on inline panels
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Inline panels now accept the optional parameters ``max_num`` and ``min_num``, to specify the maximum / minimum number of child items that must exist in order for the page to be valid.
See: :ref:`inline_panels`
2015-10-06 21:21:25 +00:00
Minor features
~~~~~~~~~~~~~~
2015-09-16 08:35:23 +00:00
* WagtailRedirectMiddleware can now ignore the query string if there is no redirect that exactly matches it
* Order of URL parameters now ignored by redirect middleware
2015-09-18 10:29:50 +00:00
* Added SQL Server compatibility to image migration
2015-09-18 15:25:27 +00:00
* Added classnames to Wagtail rich text editor buttons to aid custom styling
* Simplified body_class in default homepage template
* page_published signal now called with the revision object that was published
2015-10-05 17:41:48 +00:00
* Added a favicon to the admin interface, customisable by overriding the ``branding_favicon`` block (see :ref:`custom_branding`).
2015-10-05 21:54:37 +00:00
* Added spinner animations to long-running form submissions
* The EMBEDLY_KEY setting has been renamed to WAGTAILEMBEDS_EMBEDLY_KEY
2015-10-12 23:15:50 +00:00
* StreamField blocks are now added automatically, without showing the block types menu, if only one block type exists (Alex Gleason)
2015-10-12 23:19:51 +00:00
* The ``first_published_at`` and ``latest_revision_created_at`` fields on page models are now available as filter fields on search queries
2015-10-13 21:46:02 +00:00
* Wagtail admin now standardises on a single thumbnail image size, to reduce the overhead of creating multiple renditions
2015-10-14 16:07:26 +00:00
* Rich text fields now strip out HTML comments
2015-09-09 14:23:29 +00:00
Bug fixes
~~~~~~~~~
* Deleting a page permission from the groups admin UI does not immediately submit the form
2015-09-30 16:16:48 +00:00
* Wagtail userbar is shown on pages that do not pass a ``page`` variable to the template (e.g. because they override the ``serve`` method)
2015-10-06 10:06:44 +00:00
* ``request.site`` now set correctly on page preview when the page is not in the default site
* Project template no longer raises a deprecation warning (Maximilian Stauss)
* ``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
2015-10-14 16:16:21 +00:00
* The "view live" button displayed after publishing a page now correctly reflects any changes made to the page slug (Ryan Pineo)
2015-10-14 16:26:03 +00:00
* API endpoints now accept and ignore the ``_`` query parameter used by jQuery for cache-busting
Upgrade considerations
======================
``PageManager.sibling_of(page)`` and ``PageManager.not_sibling_of(page)`` have changed behaviour
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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)``).
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:
.. code-block:: python
>>> event_1 = EventPage.objects.get(title='Event 1')
>>> EventPage.objects.sibling_of(event_1)
[<EventPage: Event 2>] # OLD behaviour: Event 1 is not considered a sibling of itself
This has now been changed to be *inclusive* by default; that is, the page is counted as a sibling of itself:
.. code-block:: python
>>> event_1 = EventPage.objects.get(title='Event 1')
>>> EventPage.objects.sibling_of(event_1)
[<EventPage: Event 1>, <EventPage: Event 2>] # NEW behaviour: Event 1 is considered a sibling of itself
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:
.. code-block:: python
>>> event_1 = EventPage.objects.get(title='Event 1')
>>> EventPage.objects.all().sibling_of(event_1)
[<EventPage: Event 1>, <EventPage: Event 2>] # OLD and NEW behaviour
If your project includes queries that rely on the old (exclusive) behaviour, this behaviour can be restored by adding the keyword argument ``inclusive=False``:
.. code-block:: python
>>> event_1 = EventPage.objects.get(title='Event 1')
>>> EventPage.objects.sibling_of(event_1, inclusive=False)
[<EventPage: Event 2>] # passing inclusive=False restores the OLD behaviour
``Image.search`` and ``Document.search`` methods are deprecated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``Image.search`` and ``Document.search`` methods have been deprecated in favour 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:
.. code-block:: python
Image.search("Hello", filters={'uploaded_by_user': user})
can be rewritten as:
.. code-block:: python
Image.objects.filter(uploaded_by_user=user).search("Hello")