django template read JSON field in {{ jsonObject }}
I need to get one field in my JSON string which comes from
django-rest-framework. E.g. {{ myJsonString.pk }}
{% for obj in cols %}
obj={{obj|pprint}} <br><br><br> {# It prints the string in JSON
format, it comes from from django-rest-framework #}
obj.pk ={{ obj.pk }} {# Needed field in JSON string! #}
<div class="widget" id="my-id-{{ obj.pk }}">
</div> {# END class="widget" #}
{% endfor %}
Is it possible? Or I have to create a template filter similar to
http://eugene-yeo.me/2012/09/9/convert-queryset-json-template-filter/
Thanks,
D
No comments:
Post a Comment