I am having a weird problem. I am following the latest django book on
djangobook.com. I am on Chapter 4 where it is telling me to use the
following code:
from django.template.loader import get_template
from django.template import Context
from django.http import HttpResponse
import datetime
def current_datetime(request):
now = datetime.datetime.now()
t = get_template('current_datetime.html')
html = t.render(Context({'current_date': now}))
return HttpResponse(html)
However, when I use this code I get this error:
Template library django.template.loader_tags does not have a variable
named 'register'
So I change the code to this:
from django.template.loader import get_template -> from
django.template.loader_tags import get_template
And now it works!
Although, I am told by someone in IRC that this is not correct and
that get_template lives in template.loader
What is going on? Who's right and why is this working? Is the book
wrong? Here's a dpaste of the error:
http://dpaste.com/57819/
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---