#url部分
url(r'newfy',views.newfy,name="newfy"),
#views部分
def newfy(request): if request.method == "POST": dz = request.POST.get("dz") lc1 = request.POST.get("lc1") FangLie.objects.create(dz=dz, lc1=lc1,) return redirect("/fangyuan")#跳转主页 return render(request, "newfy.html",locals())
#前端部分
<form action="{% url 'newfy' %}" method="post"> {% csrf_token %} <b>房屋地址:</b><input type="text" name="dz"><br><br> <b>楼层:</b><input type="text" size="1" name="lc1"> </form>