kopia lustrzana https://github.com/wagtail/wagtail
Add documentation for the ajax_template attribute
rodzic
fa5c69ee00
commit
062ff73665
|
|
@ -17,6 +17,7 @@ Core team
|
|||
* Codie Roelf (Praekelt)
|
||||
* Lisa Adams (Praekelt)
|
||||
* Naomi Morduch Toubman
|
||||
* Kalob Taulien
|
||||
|
||||
Contributors
|
||||
============
|
||||
|
|
|
|||
|
|
@ -324,6 +324,20 @@ The template can be changed on a per-instance basis by defining a ``get_template
|
|||
In this example, pages that have the ``use_other_template`` boolean field set will use the ``blog/other_blog_page.html`` template. All other pages will use the default ``blog/blog_page.html``.
|
||||
|
||||
|
||||
Ajax Templates
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
If you want to add AJAX functionality to a page, such as a paginated listing that updates in-place on the page rather than triggering a full page reload, you can set the ``ajax_template`` attribute to specify an alternative template to be used when the page is requested via an AJAX call (as indicated by the ``X-Requested-With: XMLHttpRequest`` HTTP header):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class BlogPage(Page):
|
||||
...
|
||||
|
||||
ajax_template = 'other_template_fragment.html'
|
||||
template = 'other_template.html'
|
||||
|
||||
|
||||
More control over page rendering
|
||||
--------------------------------
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue