render_to_response – 2 variabile

# views.py


def hours_ahead(request, offset):

try:
offset = int(offset)
except ValueError:
raise Http404()
dt = datetime.datetime.now() + datetime.timedelta(hours = offset)

return render_to_response(‘hours_ahead.html’, {‘time1’: offset, ‘time2’: dt})

 

 

#
hours_ahead.html

{% extends “base.html” %}

{% block title %}Hours ahead{% endblock %}

{% block content %}
<p>Cerez {{ time }} ceasov budet {{ time2 }}.</p>
{% endblock %}

 

Leave a Reply