blob: 921921b15e9bbba0c985a94b225dc1950799cba8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
=========================
28: REST with Ajax Layout
=========================
Produce a grid-like UI to prepare for async REST operations.
Steps
=====
#. We are going to use the previous step as our starting point:
.. code-block:: bash
(env27)$ cd ..; cp -r rest_bootstrap rest_ajax_layout; cd rest_ajax_layout
(env27)$ python setup.py develop
#. Get a new menu item for ``Folders`` in
``rest_ajax_layout/tutorial/templates/layout.jinja2``:
.. literalinclude:: rest_ajax_layout/tutorial/templates/layout.jinja2
:language: html
:linenos:
#. In ``rest_ajax_layout/tutorial/views.py``, add a JSON view and remove
unused previous views:
.. literalinclude:: rest_ajax_layout/tutorial/views.py
:linenos:
#. Create a template at
``rest_ajax_layout/tutorial/templates/folder.jinja2``:
.. literalinclude:: rest_ajax_layout/tutorial/templates/folder.jinja2
:language: html
:linenos:
#. Do some cleanup:
.. code-block:: bash
(env27)$ rm tutorial/templates/*.pt
#. Run your Pyramid application with:
.. code-block:: bash
(env27)$ pserve development.ini --reload
#. Open ``http://localhost:6543/`` in your browser.
|