mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
5a65cb7554
Currently Wagtail defines `request.is_preview` as a way for both page rendering and template rendering to modify logic based on whether the page is being previewed. If a page supports multiple preview modes, though, the information about which mode is being previewed isn't made available. So, for example, it's not possible to customize `Page.serve` or `Page.get_context` based on a different preview mode. Or, consider customizing `Page.get_template` so that it uses a different page template depending on the mode being previewed. This commit adds `request.preview_mode` so that the mode is available downstream of previews, both in the page rendering logic and also in the template itself. A minor documentation change mentions this new property. |
||
---|---|---|
.. | ||
search | ||
images.rst | ||
index.md | ||
pages.md | ||
permissions.rst | ||
snippets.rst | ||
streamfield.rst | ||
writing_templates.rst |