On Feb 20, 10:01 am, kalyani ram <[email protected]> wrote:
> 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),
> )

Missing comma after the first pattern. Thus you have (r'^time/$',
current_datetime)(...), which is syntax for calling the first tuple.
That causes the error.

> 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 })

If I am not mistaken you should not have two dictionaries on the last
line, just one:
{'hour_offset': offset, 'next_time': dt }

 - Anssi

-- 
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.

Reply via email to