Opened 16 years ago

Closed 16 years ago

#7211 closed (invalid)

cannot import name hours_ahead

Reported by: selecter@… Owned by: nobody
Component: Uncategorized Version: 0.96
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

#cannot import name hours_ahead
#Request Method: GET
#Request URL: http://localhost:8000/time/plus/1/
#Exception Type: ImportError
#Exception Value: cannot import name hours_ahead

#urls.py:
from django.conf.urls.defaults import *
from views import current_datetime, hours_ahead

urlpatterns = patterns(,

(r'time/$', current_datetime),
(r'
time/plus/(\d{1,2})/$', hours_ahead),

)

#views.py:
from django.http import HttpResponse
import datetime

def current_datetime(request):

now = datetime.datetime.now()
html = "It's now %s." % now
return HttpResponse(html)

def hours_ahead(request, offset):

offset = int(offset)
dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
html = "In %s hour(s), it will be %s." % (offset, dt)
return HttpResponse(html)

Change History (2)

comment:1 by HappyCoder <selecter@…>, 16 years ago

comment:2 by Simon Greenhill, 16 years ago

Resolution: invalid
Status: newclosed

Please take support questions to the django-users mailing list, thanks!

Note: See TracTickets for help on using tickets.
Back to Top