Answer the question
In order to leave comments, you need to log in
How to change content output from db in templarte?
There is a request from a DB where 5 objects come:
I display in the for loop.
But time comes in UNIX format (ex. 15561253451), I want to get str format.
{% extends 'user/template.html' %}
{% block content %}
{% for signal in signals %}
{{ signal.close_time }}
{% endfor %}
{% endblock %}
{% extends 'user/template.html' %}
{% block content %}
{% for signal in signals %}
{{ datetime.utcfromtimestamp(signal["close_time"]).strftime('%Y-%m-%d %H:%M:%S') }}
{% endfor %}
{% endblock %}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question