import datetime
def fishspeed_bonus(request):
now = datetime.datetime.now()
bonus_time = request.session.get("bonus_time")
if bonus_time:
delta = now - datetime.datetime.fromisoformat(bonus_time)
if delta.days > 0:
bonus = True
else:
bonus = False
else:
request.session['bonus_time'] = datetime.datetime.now().isoformat()
bonus = True
return render(request, 'fishspeed/bonus.html', {"bonus": bonus})
{% if bonus %}
<button type="submit" class="btn btn-blue btn-righ" name="button" value="button">GET BONUS</button>
{% else %}
<b class="my">Next bonus after 24 hours</b>
{% endif %}
</center>