I'm having trouble with the Django URL-View system. I've been trying out a view:
#views.py...
def IsolatedForm(request, lat, lng, slug):
if not request.user.is_authenticated():
return redirect('login')
chosen_form = Form.objects.filter(slug=slug)
return render(request, 'polls/isolatedform.html', {'chosen_form':chosen_form, 'lng': lng, 'lat': lat})
I've associated it with a URL pattern that takes a couple of floats (coordinate values) and a slug:
#urls.py...
url(r'^testing/(-?\d+\.\d+),(-?\d+\.\d+)/(?P<slug>.*)/$', views.IsolatedForm, name='isolatedform'),
When I try this URL pattern with, for example (with the App name being polls):
polls/testing/1.0,-1.0/postchaos/
(where "postchaos" is an example slug that corresponds to an existing Form) I get:
TypeError at /polls/testing/1.0,-1.0/postchaos/ IsolatedForm() takes exactly 4 arguments (2 given)
I'm not being able to realize what the actual issue is, as the URL I've tried contains the expected numbers and the expected slug. Any help would be appreciated.