1

this is my template, how can i compare the date now with my myaccount.modifyDate ?

<input   name="temperature" value="{% if {% now 'F jS Y' %} >= myaccount.modifyDate   %} 0.0 {% else %} {{myaccount.bodyTemperature}} {% endif %}" readonly></td>

Update i tried this also

<input   name="temperature" value="{% if ( {% now 'F jS Y' %} ) >= myaccount.modifyDate   %} 0.0 {% else %} {{myaccount.bodyTemperature}} {% endif %}" readonly></td>

and the error is

Could not parse the remainder: '(' from '('

1 Answers1

2

in your models

from datetime import date
@property
    def is_past_due(self):
        return date.today() > self.modifyDate
    class Meta:

and do this in your html

<input   name="temperature" value="{% if myaccount.is_past_due  %} 0.0  {% else %}  {{myaccount.bodyTemperature}} {% endif %}" readonly>

for more information click this How to compare dates in Django templates