Hey all, I am recently trying out the examples from the link http://www.djangobook.com/en/1.0/chapter03/, where the current time have to be displayed and then modify and display the offset. I was able to display the time without any issue, but with the offset part, i get the error TypeError at /time/plus/1 'tuple' object is not callable Exception location: mysite\urls.py in <module>, line 6
My urls.py is as follows. from django.conf.urls.defaults import * from mysite.views import current_datetime, hours_ahead urlpatterns = patterns('', (r'^time/$', current_datetime) (r'^time/plus/(\d{1,2})/$', hours_ahead), ) my views.py is as follows. from django.shortcuts import render_to_response import datetime def current_datetime(request): now = datetime.datetime.now() return render_to_response('temp.html', {'current_date': now}) def hours_ahead(request, offset): offset = int(offset) dt = datetime.datetime.now() + datetime.timedelta(hours=offset) return render_to_response('temp.html', {'hour_offset': offset}, {'next_time': dt }) my temp.html is as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <title>Future time</title> </head> <body> <h1>My helpful timestamp site</h1> <p>In {{ hour_offset }} hour(s), it will be {{ next_time }}.</p> <hr> <p>Thanks for visiting my site.</p> </body> </html> pls help. I am really lost :( -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.