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

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top