hi i am fairly new to django and i want to update some of my contents in the django DB for this i have written a little view function. which looks like this
def status_change(request,id):
instance = get_object_or_404(register,id=id)
if request.method == 'POST':
rform = registerForm(instance=instance, data=request.POST)
if rform.is_valid():
instance = rform.save()
return render_to_response('home.html')
else:
rform = registerForm(instance=instance)
return render_to_response('status_change.html',{'rform':rform})
i want to pass this "id" from template to the "view". my urls lopk like this
(r'^status/(?P<id>\d+)$', views.status_change),
and when i use
(r'^status/(?P<id>\d+)$', views.status_change, name ='status_change'),
it barks as syntax error on this line
and in my template i have
<a href = "/status/{{user.id}}">Change Status</a>
but this whole thing is not getting the id from the template/url am i making a mistake somewhere. any help will be greatly appreciated
Thanks in advance