Jinja Clas Notes
Exercises for the Jinja class.
Jinja is really quite easy.
Here is the Jinja Template Documentation.
Here are a few interesting Jinja commands
-
{{ foo.bar }} {{ foo['bar'] }}
{% ... %}
for Statements -
{{ ... }}
for Expressions to print to the template output -
{# ... #}
for Comments not included in the template output
Here are the Forest Wiki values Jinja can access.
- name : The URL slug
- __name__: use if "name" does not work .
- title: a human readable version of the slug.
- description: Keep it short.
- source: Most often HTMl. Could be anything.
- values(): Iterate over the children.
- items(): Iterate over the children.
- keys(): Iterate over the children.
- asDict(): JSON and (soon) YAML objects return Python Dicts.
- asString(): JSON objects can return a string.
- secureParent(): cannot access content of other users.
Here are some more interesting Jinja commands.
jinja-globals.lipsum(n=5, html=True, min=20, max=100)
Generates some lorem ipsum for the template. By default, five paragraphs of HTML
Student Exercises
1. Display the parents.
2. Display the siblings.
3. Display a site map
4. Use inheritance
Teacher Exercises
You do not have root permission, so you cannot inspect the work of other students. But the Forest Wiki supports hierarchical security model, which will allow you act as a teacher. In the manage view, use the Node->Security to grant permissions to two others. The person before you and after you alphabetically in the chat room. Ask them to create a simple Jinja object. You can now click into their objects edit and view them.
Strictly speaking they can now do the same to you. So best to create a folder for each of them. Beginner->Folder. And then they can view, but not edit your root directory.
In large distributed organizations, such as the US Green Party, hiearchical security is a very powerful model, remarkably simple to implement.
Built using the Forest Map Wiki