【发布时间】:2016-03-03 13:02:33
【问题描述】:
我想当我点击/circle页面中的蓝色div时,将值“niloofar”发送到/final,输出必须是** niloofar **,但它不起作用。
如何编辑它? 我想通过隐藏输入发送值。
views.py:
from django.shortcuts import render
def circle(request):
return render(request, 'circle.html')
def final(request):
matn = request.POST.get("title", "")
return render(request, 'final.html', {'matn': matn})
circle.html:
<html>
<head>
<style>
div {
width:100px;
height:100px;
background:lightblue;
}
</style>
</head>
<body>
<a href="/final">
<div></div>
<input type="hidden" name="title" value="niloofar">
</a>
final.html:
** {{ matn }} **
urls.py:
from django.conf.urls import include, url
from secondv.views import circle, final
urlpatterns = [
url(r'^circle/', circle),
url(r'^final/', final),
]
【问题讨论】:
-
那么你在哪里定义
message? 什么“不起作用”意味着什么?错误?结果无效? -
我已经编辑了我的问题。
-
没有错误只是值不会出现,只是开始。