I am getting an error in my Django project, and it looks like this comes from the views.py file:
from django.template.loader import get_template from django.template import Context from django.http import HttpResponse import datetime def get_date_time(request): now = datetime.datetime.now() return render(request, 'date_time.html', {'current_date': now})
Error: global name 'render' is not defined
What can I do to solve this problem?
EDIT
Decision:
t = get_template('document.html') html = t.render(Context({'variable': value})) return HttpResponse(html)
source share