Я хочу передать параметр, когда нажимаю кнопку отправки.
urls.py
urlpatterns = patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
(r'^home/$', 'views.home'),
(r'^home/(?P<build>[^/]+)/$', 'views.run'),
(r'^run/delete/$', 'views.runDelete')
)
run.html
<form name="form" method="post" action="/run/delete">
<input type="submit" value="Delete" style="margin-left:149px; width:80px; height:30px">
<table border="1"; borderColor=black>
<td></td>
<td><b>Run</b></td>
{% for run in run_list %}
<tr>
<td>{{run.build}}</td>
<td><input type="checkbox" name="var_delete" value="{{run.id}}"></td>
<td>{{run.name}}</td>
</tr>
{% endfor %}
</table>
</form>
views.py
def run(request, build):
run_list = TestRun.objects.all().order_by('id')
return render_to_response('run.html', {'run_list': run_list})
def runDelete(request):
run_list = request.POST.getlist('var_delete')
for run in run_list:
run = int(run)
TestRun.objects.get(id=run).delete()
return render_to_response('???')
Я хочу показать новый run.html , но как я могу передать run.build в качестве параметра runDelete?спасибо: D