你好,我已经搜索了这个问题,但一切都没有用。所以请帮助我。
url.py:
url(r'^file_parse/$', file_parse),
url(r'^data_bi/(?P<data_list_id>\d+)/$', data_to_list, name = 'data_to_list'),
file_parse.html:
{% for item in uploadfile_info %}
<tbody>
<tr>
<td>{{ item.uploaded_at }}</td>
<td>{{ item.document }}</td>
<td>{{ item.description }}</td>
<td>
{% csrf_token %}
<a href="{% url 'data_bi_list' item.id %}">{{ item.description }} </a>
</tr>
</tbody>
{% endfor %}
file_parse.py:
def file_parse(request):
uploadfile_info = upload_document.objects.all()
context = {'uploadfile_info': uploadfile_info}
return render(request, 'logfile/file_parse.html', context)
data_bi.py:
def data_to_list(request, data_list_id):
data_list = ES_device.objects.get(device_name=str(data_list_id))
context = {'data_list': data_list}
return render(request, 'logfile/data_bi.html', context)
答案 0 :(得分:0)
您想在模板中使用'data_to_list'
而不是'data_bi_list'
吗?你的网址是'data_to_list'
。
...
<a href="{% url 'data_to_list' item.id %}">
...