Skip to content Skip to sidebar Skip to footer

Django 1.7: Some_name() Takes Exactly 2 Arguments (1 Given)

this is my view.py from django.http import HttpResponse import datetime def current_datetime(request): now = datetime.datetime.now() html = 'It is

Solution 1:

You need to capture the offset from the url:

url(r'^time/plus/(\d+)/$', 'mysite.view.hours_ahead', name='hours_ahead'),

where (\d+) is a capturing group that would capture one or more digits. In case of localhost:8000/time/plus/24/ it would capture 24.

Solution 2:

offset is missing here:

url(r'$', 'mysite.view.hours_ahead', name='hours_ahead'),

Post a Comment for "Django 1.7: Some_name() Takes Exactly 2 Arguments (1 Given)"