我写了一个登录页面,该页面被委托进行约会。除了制作新帖子和编辑它们之外,一切都有效。这个html页面给我带来了麻烦。
Name1_Total_A.csv
Name2_Total_B.csv
Name1_Total_A.csv
Name2_Total_B.csv
我希望能够将此页面中的信息添加到表格
`!DOCTYPE html>
<html>
<head>
<a href="/logout">Logout</a>
<title>What's Up</title>
<h1>Hello </h1>
<p>Here are your appointments for today</p>
</head>
<body>
<form action="/create">
{% csrf_token %}
<table>
<thead>
<tr>
<th>Task</th>
<th>Time</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>Jojos Bizaree Adventure</td>
<td>11:00PM</td>
<td>Done</td>
<td><a href="/edit">Edit</a>
<a href="/delete">Delete</a></td>
</tr>
</tbody>
</table>
</form>
<p>Your other appointments</p>
<table>
<thead>
<tr>
<th>Task</th>
<th>Date</th>
<th>Time</th>
</tr>
</thead>
<tbody>
{%for appt in appts%}
<td>Task:{{appts.task}}</td>
<td>Date:{{appts.date}}</td>
<td>Time:{{appts.time}}</td>
<td><p><a href="/edit">Edit</a></p>
<td><a href="/delete">Delete</a></td>
{% endfor %}
</tbody>
</table>
<form action="/update" method="POST">
{% csrf_token %}
<p>Add Appointment:</p>
<button type="submit" value="addappoint">Add</button>
</form>
</body>
</html>'
并使用此页面编辑相关数据
enter code here<!DOCTYPE html>
<html>
<head>
<title>Update Appointment</title>
<a href="appointments.html">Dashboard</a> ||<a href="/logout">Logout</a>
</head>
<body>
<form action="/create" method="POST">
{% csrf_token %}
<p>Task: <input type="text"></p>
<p>Status: <input type="radio">Done<br>
<input type="radio">Pending<br>
<input type="radio">Missed<br>
</p>
<p>Date: <input type="date"></p>
<p>Time:<input type="time"></p>
<button type="submit" value="newappoint">Update</button>
</form>
</body>
</html>
我已经尝试将输入放在上下文字典中并且不起作用。 这里是我认为问题所在的django文件。
以下是我的网址
`<!DOCTPYPE html>
<html>
<head>
<h1>Edit Appointment</h1>
<a href="/success">Dashboard</a> ||<a href="/logout">Logout</a>
</head>
<body>
<form action="/sucess" method="POST">
<table>
</tr>
</thead>
<tbody>
<form action="/sucess" method="POST">
{% csrf_token %}
<p>Edit Appointment</p>
<p>Date: <input type="date" name="date"></p>
<p>Time: <input type="time" name="time"></p>
<p>Task: <input type="text" name="task">
</p>
<button type="submit" value="addappoint">Edit</button>
</form>
</tbody>
</table>
</form>
</body>
</html>`
这是我的观点
from django.conf.urls import url
from . import views
urlpatterns=[
url(r'^$',views .index),
url(r'^register$', views .register),
url(r'^login$',views.login),
url(r'^success$', views.success),
url(r'^new$', views.new),
url(r'^logout$',views.logout),
url(r'^delete$',views.delete),
url(r'^edit$',views.edit),
url(r'^create$', views.create),
url(r'^update$',views.update)
]