我有班上的人
class People (models.Model): first_name = models.CharField(max_length = 50) last_name = models.CharField(max_length = 50) email = models.EmailField(blank = True) grade = models.CharField(max_length = 2) def __unicode__(self): return '%s %s' % (self.first_name,self.last_name)
我有删除视图
def delete(request): query = People.objects.get(pk=id) query.delete() return HttpResponse("Deleted!")
我有html模板代码
{% for person in people_list %} <TR ALIGN="CENTER"> <td>{{ person.first_name }}</td> <td>{{ person.last_name }}</td> <td>{{ person.email }}</td> <td>{{ person.grade }}</td> <td><form action="/modify.html"> <input type="submit" value="Modify"> </form></td> <td><form action="/delete.html"> <input type="submit" value="Delete"> </form></td> </TR> {% endfor %}