Opened 8 years ago

Closed 7 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: UI/UX:


#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
from django.conf.urls.defaults import *
from views import current_datetime, hours_ahead

urlpatterns = patterns(,

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

from django.http import HttpResponse
import datetime

def current_datetime(request):

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

def hours_ahead(request, offset):

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

Change History (2)

comment:1 Changed 8 years ago by HappyCoder <selecter@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by Simon Greenhill

  • Resolution set to invalid
  • Status changed from new to closed

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

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