A
A
Almaz Akimov2021-12-04 08:59:17
Python
Almaz Akimov, 2021-12-04 08:59:17

How to compare date with current and execute in jinja template?

Why Unused ''dmy'' at end of if expression.?

{% for date in date_list %}
        {% if date.grouper|date:'dmy' ==  now 'dmy' %}
           {% now 'dmy' %}

        {% endif %}
     {% endfor %}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Almaz Akimov, 2021-12-04
@GolosB

Solved a problem. Passed the ready-made variable now_date = datetime.now() to jinja

{% for date in date_list %}
       {% if date.grouper|date:'dmy' == now_date|date:'dmy' %}
              {% now 'dmy' %}
       {% endif %}
     {% endfor %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question