pongo2-addons
pongo2-addons copied to clipboard
Bindjson Tag
Hello and thank you for pongo. I love Django and this was exactly what I needed!
I added a tag, that allows binding a json data file to a variable local to the block the tag surrounds.
Example:
{% bindjson "../data/data.json" as data %}
<h1>{{ data.category }}</h1>
<ul>
{% for item in data.items %}
<li>{{ item.caption }}</li>
{% endfor %}
</ul>
{% endbindjson %}
I would love to add tests, but I am relatively new to Go and am not quite sure how to mock the file reading and test for syntax errors in my tag's arguments. Maybe you have some pointers into the right direction?
Please let me know if you consider adding it :)
Kind Regards