Django templates and variable attributes

后端 未结 6 556
忘掉有多难
忘掉有多难 2020-12-02 13:43

I\'m using Google App Engine and Django templates.
I have a table that I want to display the objects look something like:

Object Result:
    Items =          


        
6条回答
  •  感动是毒
    2020-12-02 13:59

    As a replacement for k,v in user.items on Google App Engine using django templates where user = {'a':1, 'b', 2, 'c', 3}

    {% for pair in user.items %}
       {% for keyval in pair %} {{ keyval }}{% endfor %}
    {% endfor %}

    a 1
    b 2
    c 3

    pair = (key, value) for each dictionary item.

提交回复
热议问题