On Sun, Oct 10, 2010 at 8:44 AM, Sleek <slee...@gmail.com> wrote:

> I'm a newbie to Django/Python world (PHP guy). I'm just going through
> some tutorials to get things figured out. Everything was working fine
> until when I was working through the last section of
> http://djangobook.com/en/2.0/chapter03/ on Dynamic URLs. It seems be
> an error in the views.py. When I enter the follow:
> def hours_ahead(request, offset):
> # try:
> # offset = int(offset)
> # except ValueError:
> # raise Http404()
> dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
> html = "<html><body>In %s hour(s), it will be %s.</body></html>" %
> (offset, dt)
> return HttpResponse(html)
>
> I got to this error: TypeError....hours_ahead() takes exactly 2
> arguments (1 given)
> It mentions: Exception Location: /usr/lib/pymodules/python2.6/django/
> core/handlers/base.py in get_response, line 92
>
> It would seem to be some error with the get_response. Have I set
> something up wrong that it isn't pulling the information back
> correctly?
>

It sounds like you have not followed the instructions to put parentheses
around the data in the url pattern that you want to have passed into the
view (the paragraph that starts "Now that we’ve designated a wildcard for
the URL, we need a way of passing that wildcard data to the view function,
so that we can use a single view function for any arbitrary hour offset."

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to