# [pongo](https://en.wikipedia.org/wiki/Pongo_%28genus%29)2
[](https://godoc.org/github.com/iris-contrib/pongo2)
[](https://travis-ci.org/iris-contrib/pongo2)
pongo2 is the django template syntax for [Iris](https://github.com/kataras/iris).
## First impression of a template
```HTML+Django
Our admins and users
{# This is a short example to give you a quick overview of pongo2's syntax. #}
{% macro user_details(user, is_admin=false) %}
= 40) || (user.karma > calc_avg_karma(userlist)+5) %}
class="karma-good"{% endif %}>
{{ user }}
This user registered {{ user.register_date|naturaltime }}.
The user's biography:
{{ user.biography|markdown|truncatewords_html:15 }}
read more
{% if is_admin %}
This user is an admin!
{% endif %}
{% endmacro %}
Our admins
{% for admin in adminlist %}
{{ user_details(admin, true) }}
{% endfor %}
Our members
{% for user in userlist %}
{{ user_details(user) }}
{% endfor %}
```
# Documentation
For a documentation on how the templating language works you can [head over to the Django documentation](https://docs.djangoproject.com/en/dev/topics/templates/). pongo2 aims to be compatible with it.
You can access pongo2's API documentation on [godoc](https://godoc.org/github.com/iris-contrib/pongo2).
## Caveats
### Filters
* **date** / **time**: The `date` and `time` filter are taking the Golang specific time- and date-format (not Django's one) currently. [Take a look on the format here](http://golang.org/pkg/time/#Time.Format).
* **stringformat**: `stringformat` does **not** take Python's string format syntax as a parameter, instead it takes Go's. Essentially `{{ 3.14|stringformat:"pi is %.2f" }}` is `fmt.Sprintf("pi is %.2f", 3.14)`.
* **escape** / **force_escape**: Unlike Django's behaviour, the `escape`-filter is applied immediately. Therefore there is no need for a `force_escape`-filter yet.
### Tags
* **for**: All the `forloop` fields (like `forloop.counter`) are written with a capital letter at the beginning. For example, the `counter` can be accessed by `forloop.Counter` and the parentloop by `forloop.Parentloop`.
* **now**: takes Go's time format (see **date** and **time**-filter).
### Misc
* **not in-operator**: You can check whether a map/struct/string contains a key/field/substring by using the in-operator (or the negation of it):
`{% if key in map %}Key is in map{% else %}Key not in map{% endif %}` or `{% if !(key in map) %}Key is NOT in map{% else %}Key is in map{% endif %}`.
# Add-ons, libraries and helpers
## Official
* [pongo2-addons](https://github.com/iris-contrib/pongo2-addons) - Official additional filters/tags for pongo2 (for example a **markdown**-filter). They are in their own repository because they're relying on 3rd-party-libraries.
# API-usage examples
Please see the documentation for a full list of provided API methods.
Please refer to [kataras/iris/_examples/view](https://github.com/kataras/iris/tree/master/_examples/view)
## Contributors
This project exists thanks to all the people who contribute.