1.0.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. =========================
  2. Wagtail 1.0 release notes
  3. =========================
  4. .. contents::
  5. :local:
  6. :depth: 1
  7. What's changed
  8. ==============
  9. StreamField - a field type for freeform content
  10. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. StreamField provides an editing model for freeform content such as blog posts and news stories, allowing diverse content types such as text, images, headings, video and more specialised types such as maps and charts to be mixed in any order. See :ref:`streamfield`.
  12. Wagtail API - A RESTful API for your Wagtail site
  13. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. When installed, the new Wagtail API module provides a RESTful web API to your
  15. Wagtail site. You can use this for accessing your raw field content for your
  16. sites pages, images and documents in JSON format.
  17. MySQL support
  18. ~~~~~~~~~~~~~
  19. Wagtail now officially supports MySQL as a database backend.
  20. Django 1.8 support
  21. ~~~~~~~~~~~~~~~~~~
  22. Wagtail now officially supports running under Django 1.8.
  23. Vanilla project template
  24. ~~~~~~~~~~~~~~~~~~~~~~~~
  25. The built-in project template is more like the Django built-in one with several
  26. Wagtail-specific additions. It includes bare minimum settings and two apps (home and search).
  27. Minor changes
  28. ~~~~~~~~~~~~~
  29. * Dropped Django 1.6 support
  30. * Dropped Python 2.6 and 3.2 support
  31. * Dropped Elasticsearch 0.90.x support
  32. * Removed dependency on ``libsass``
  33. * Users without usernames can now be created and edited in the admin interface
  34. * Added new translations for Croatian and Finnish
  35. Core
  36. ----
  37. * The Page model now records the date/time that a page was first published, as the field ``first_published_at``
  38. * Increased the maximum length of a page slug from 50 to 255 characters
  39. * Added hooks ``register_rich_text_embed_handler`` and ``register_rich_text_link_handler`` for customising link / embed handling within rich text fields
  40. * Page URL paths can now be longer than 255 characters
  41. Admin
  42. -----
  43. **UI**
  44. * Improvements to the layout of the left-hand menu footer
  45. * Menu items of custom apps are now highlighted when being used
  46. * Added thousands separator for counters on dashboard
  47. * Added contextual links to admin notification messages
  48. * When copying pages, it is now possible to specify a place to copy to
  49. * Added pagination to the snippets listing and chooser
  50. * Page / document / image / snippet choosers now include a link to edit the chosen item
  51. * Plain text fields in the page editor now use auto-expanding text areas
  52. * Added "Add child page" button to admin userbar
  53. * Added update notifications (See: :ref:`update_notifications`)
  54. **Page editor**
  55. * JavaScript includes in the admin backend have been moved to the HTML header, to accommodate form widgets that render inline scripts that depend on libraries such as jQuery
  56. * The external link chooser in rich text areas now accepts URLs of the form '/some/local/path', to allow linking to non-Wagtail-controlled URLs within the local site
  57. * Bare text entered in rich text areas is now automatically wrapped in a paragraph element
  58. **Edit handlers API**
  59. * ``FieldPanel`` now accepts an optional ``widget`` parameter to override the field's default form widget
  60. * Page model fields without a ``FieldPanel`` are no longer displayed in the form
  61. * No longer need to specify the base model on ``InlinePanel`` definitions
  62. * Page classes can specify an edit_handler property to override the default Content / Promote / Settings tabbed interface. See :ref:`customising_the_tabbed_interface`.
  63. **Other admin changes**
  64. * SCSS files in wagtailadmin now use absolute imports, to permit overriding by user stylesheets
  65. * Removed the dependency on ``LOGIN_URL`` and ``LOGIN_REDIRECT_URL`` settings
  66. * Password reset view names namespaced to wagtailadmin
  67. * Removed the need to add permission check on admin views (now automated)
  68. * Reversing ``django.contrib.auth.admin.login`` will no longer lead to Wagtails login view (making it easier to have frontend login views)
  69. * Added cache-control headers to all admin views. This allows Varnish/Squid/CDN to run on vanilla settings in front of a Wagtail site
  70. * Date / time pickers now consistently use times without seconds, to prevent JavasSript behaviour glitches when focusing / unfocusing fields
  71. * Added hook ``construct_homepage_summary_items`` for customising the site summary panel on the admin homepage
  72. * Renamed the ``construct_wagtail_edit_bird`` hook to ``construct_wagtail_userbar``
  73. * 'static' template tags are now used throughout the admin templates, in place of ``STATIC_URL``
  74. Docs
  75. ----
  76. * Support for ``django-sendfile`` added
  77. * Documents now served with correct mime-type
  78. * Support for ``If-Modified-Since`` HTTP header
  79. Search
  80. ------
  81. * Search view accepts "page" GET parameter in line with pagination
  82. * Added :ref:`wagtailsearch_backends_auto_update` flag to search backend settings to enable/disable automatically updating the search index on model changes
  83. Routable pages
  84. --------------
  85. * Added a new decorator-based syntax for RoutablePage, compatible with Django 1.8
  86. Bug fixes
  87. ~~~~~~~~~
  88. * The ``document_served`` signal now correctly passes the Document class as ``sender`` and the document as ``instance``
  89. * Image edit page no longer throws ``OSError`` when the original image is missing
  90. * Collapsible blocks stay open on any form error
  91. * Document upload modal no longer switches tabs on form errors
  92. * ``with_metaclass`` is now imported from Django's bundled copy of the ``six`` library, to avoid errors on Mac OS X from an outdated system copy of the library being imported
  93. Upgrade considerations
  94. ======================
  95. Support for older Django/Python/Elasticsearch versions dropped
  96. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  97. This release drops support for Django 1.6, Python 2.6/3.2 and Elasticsearch 0.90.x. Please make sure these are updated before upgrading.
  98. If you are upgrading from Elasticsearch 0.90.x, you may also need to update the ``elasticsearch`` pip package to a version greater than ``1.0`` as well.
  99. Wagtail version upgrade notifications are enabled by default
  100. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101. Starting from Wagtail 1.0, the admin dashboard will (for admin users only) perform a check to see if newer releases are available. This also provides the Wagtail team with the hostname of your Wagtail site. If you’d rather not receive update notifications, or if you’d like your site to remain unknown, you can disable it by adding this line to your settings file:
  102. .. code-block:: python
  103. WAGTAIL_ENABLE_UPDATE_CHECK = False
  104. ``InlinePanel`` definitions no longer need to specify the base model
  105. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  106. In previous versions of Wagtail, inline child blocks on a page or snippet were defined using a declaration like:
  107. .. code-block:: python
  108. InlinePanel(HomePage, 'carousel_items', label="Carousel items")
  109. It is no longer necessary to pass the base model as a parameter, so this declaration should be changed to:
  110. .. code-block:: python
  111. InlinePanel('carousel_items', label="Carousel items")
  112. The old format is now deprecated; all existing ``InlinePanel`` declarations should be updated to the new format.
  113. Custom image models should now set the ``admin_form_fields`` attribute
  114. ----------------------------------------------------------------------
  115. Django 1.8 now requires that all the fields in a ``ModelForm`` must be defined in its ``Meta.fields`` attribute.
  116. As Wagtail uses Django's ``ModelForm`` for creating image model forms, we've added a new attribute called ``admin_form_fields``
  117. that should be set to a ``tuple`` of field names on the image model.
  118. See :ref:`custom_image_model` for an example.
  119. You no longer need ``LOGIN_URL`` and ``LOGIN_REDIRECT_URL`` to point to Wagtail admin.
  120. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  121. If you are upgrading from an older version of Wagtail, you probably want to remove these from your project settings.
  122. Previously, these two settings needed to be set to ``wagtailadmin_login`` and ``wagtailadmin_dashboard``
  123. respectively or Wagtail would become very tricky to log in to. This is no longer the case and Wagtail
  124. should work fine without them.
  125. ``RoutablePage`` now uses decorator syntax for defining views
  126. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  127. In previous versions of Wagtail, page types that used the :class:`~wagtail.contrib.wagtailroutablepage.models.RoutablePageMixin` had endpoints configured by setting their :attr:`~wagtail.contrib.wagtailroutablepage.models.RoutablePageMixin.subpage_urls` attribute to a list of urls with view names. This will not work on Django 1.8 as view names can no longer be passed into a url (see: https://docs.djangoproject.com/en/stable/releases/1.8/#django-conf-urls-patterns).
  128. Wagtail 1.0 introduces a new syntax where each view function is annotated with a ``@route`` decorator - see :ref:`routable_page_mixin`.
  129. The old ``subpage_urls`` convention will continue to work on Django versions prior to 1.8, but this is now deprecated; all existing ``RoutablePage`` definitions should be updated to the decorator-based convention.
  130. Upgrading from the external ``wagtailapi`` module.
  131. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  132. If you were previously using the external ``wagtailapi`` module (which has now become ``wagtail.contrib.wagtailapi``). Please be aware of the following backwards-incompatible changes:
  133. **1. Representation of foreign keys has changed**
  134. Foreign keys were previously represented by just the value of their primary key.
  135. For example:
  136. .. code-block:: python
  137. "feed_image": 1
  138. This has now been changed to add some ``meta`` information:
  139. .. code-block:: python
  140. "feed_image": {
  141. "id": 1,
  142. "meta": {
  143. "type": "wagtailimages.Image",
  144. "detail_url": "http://api.example.com/api/v1/images/1/"
  145. }
  146. }
  147. **2. On the page detail view, the "parent" field has been moved out of meta**
  148. Previously, there was a "parent" field in the "meta" section on the page detail
  149. view:
  150. .. code-block:: python
  151. {
  152. "id": 10,
  153. "meta": {
  154. "type": "demo.BlogPage",
  155. "parent": 2
  156. },
  157. ...
  158. }
  159. This has now been moved to the top level. Also, the above change to how foreign
  160. keys are represented applies to this field too:
  161. .. code-block:: python
  162. {
  163. "id": 10,
  164. "meta": {
  165. "type": "demo.BlogPage"
  166. },
  167. "parent": {
  168. "id": 2,
  169. "meta": {
  170. "type": "demo.BlogIndexPage"
  171. }
  172. }
  173. ...
  174. }
  175. Celery no longer automatically used for sending notification emails
  176. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  177. Previously, Wagtail would try to use Celery whenever the ``djcelery`` module was
  178. installed, even if Celery wasn't actually set up. This could cause a very hard
  179. to track down problem where notification emails would not be sent so this
  180. functionality has now been removed.
  181. If you would like to keep using Celery for sending notification emails, have a
  182. look at: `django-celery-email <https://pypi.python.org/pypi/django-celery-email>`_
  183. Login/Password reset views renamed
  184. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  185. It was previously possible to reverse the Wagtail login view using ``django.contrib.auth.views.login``.
  186. This is no longer possible. Update any references to ``wagtailadmin_login``.
  187. Password reset view name has changed from ``password_reset`` to ``wagtailadmin_password_reset``.
  188. JavaScript includes in admin backend have been moved
  189. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  190. To improve compatibility with third-party form widgets, pages within the Wagtail admin backend now output their JavaScript includes in the HTML header, rather than at the end of the page. If your project extends the admin backend (through the ``register_admin_menu_item`` hook, for example) you will need to ensure that all associated JavaScript code runs correctly from the new location. In particular, any code that accesses HTML elements will need to be contained in an 'onload' handler (e.g. jQuery's ``$(document).ready()``).
  191. EditHandler internal API has changed
  192. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  193. While it is not an official Wagtail API, it has been possible for Wagtail site implementers to define their own ``EditHandler`` subclasses for use in panel definitions, to customise the behaviour of the page / snippet editing forms. If you have made use of this facility, you will need to update your custom EditHandlers, as this mechanism has been refactored (to allow EditHandler classes to keep a persistent reference to their corresponding model). If you have only used Wagtail's built-in panel types (``FieldPanel``, ``InlinePanel``, ``PageChooserPanel`` and so on), you are unaffected by this change.
  194. Previously, functions like ``FieldPanel`` acted as 'factory' functions, where a call such as ``FieldPanel('title')`` constructed and returned an ``EditHandler`` subclass tailored to work on a 'title' field. These functions now return an object with a ``bind_to_model`` method instead; the EditHandler subclass can be obtained by calling this with the model class as a parameter. As a guide to updating your custom EditHandler code, you may wish to refer to `the relevant change to the Wagtail codebase <https://github.com/wagtail/wagtail/commit/121c01c7f7db6087a985fa8dc9957bc78b9f6a6a>`_.
  195. chooser_panel templates are obsolete
  196. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  197. If you have added your own custom admin views to the Wagtail admin (e.g. through the ``register_admin_urls`` hook), you may have used one of the following template includes to incorporate a chooser element for pages, documents, images or snippets into your forms:
  198. - ``wagtailadmin/edit_handlers/chooser_panel.html``
  199. - ``wagtailadmin/edit_handlers/page_chooser_panel.html``
  200. - ``wagtaildocs/edit_handlers/document_chooser_panel.html``
  201. - ``wagtailimages/edit_handlers/image_chooser_panel.html``
  202. - ``wagtailsnippets/edit_handlers/snippet_chooser_panel.html``
  203. All of these templates are now deprecated. Wagtail now provides a set of Django form widgets for this purpose - ``AdminPageChooser``, ``AdminDocumentChooser``, ``AdminImageChooser`` and ``AdminSnippetChooser`` - which can be used in place of the ``HiddenInput`` widget that these form fields were previously using. The field can then be rendered using the regular ``wagtailadmin/shared/field.html`` or ``wagtailadmin/shared/field_as_li.html`` template.
  204. ``document_served`` signal arguments have changed
  205. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  206. Previously, the ``document_served`` signal (which is fired whenever a user downloads a document) passed the document instance as the ``sender``. This has now been changed to correspond the behaviour of Django's built-in signals; ``sender`` is now the ``Document`` class, and the document instance is passed as the argument ``instance``. Any existing signal listeners that expect to receive the document instance in ``sender`` must now be updated to check the ``instance`` argument instead.
  207. Custom image models must specify an ``admin_form_fields`` list
  208. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  209. Previously, the forms for creating and editing images followed Django's default behaviour of showing all fields defined on the model; this would include any custom fields specific to your project that you defined by subclassing ``AbstractImage`` and setting ``WAGTAILIMAGES_IMAGE_MODEL``. This behaviour is risky as it may lead to fields being unintentionally exposed to the user, and so Django has deprecated this, for removal in Django 1.8. Accordingly, if you create your own custom subclass of ``AbstractImage``, you must now provide an ``admin_form_fields`` property, listing the fields that should appear on the image creation / editing form - for example:
  210. .. code-block:: python
  211. from wagtail.wagtailimages.models import AbstractImage, Image
  212. class MyImage(AbstractImage):
  213. photographer = models.CharField(max_length=255)
  214. has_legal_approval = models.BooleanField()
  215. admin_form_fields = Image.admin_form_fields + ['photographer']
  216. ``construct_wagtail_edit_bird`` hook has been renamed
  217. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  218. Previously you could customize the Wagtail userbar using the ``construct_wagtail_edit_bird`` hook.
  219. The hook has been renamed to ``construct_wagtail_userbar``.
  220. The old hook is now deprecated; all existing ``construct_wagtail_edit_bird`` declarations should be updated to the new hook.
  221. ``IMAGE_COMPRESSION_QUALITY`` setting has been renamed
  222. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223. The ``IMAGE_COMPRESSION_QUALITY`` setting, which determines the quality of saved JPEG images as a value from 1 to 100, has been renamed to ``WAGTAILIMAGES_JPEG_QUALITY``. If you have used this setting, please update your settings file accordingly.