简体   繁体   中英

Array content malformed when used on html

I have the following loop:

for elem in Data.objects.filter(user=id):
                variables['labels'].append(time.strftime("%H%M%S", time.localtime(elem.timestamp)))

This produces the following result:

['000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000']

But when I inspect the html this is the result:

labels: ['000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000', '000000']

Why this happens?

我用以下过滤器解决了它:

{{ data.labels|safe }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM