我只想显示数据库中的选定列,例如:
Select coloum1, coloum2, coloum3 from Table1;
我只想显示三列。使用Entry.objects.all()
不允许我这样做。现在,在检索每一列后,我得到这种格式的数据:
ok.py 172.16.0.161 January 07, 2013, 11:36AM January 07, 2013, 11:36AM 0 bytes
我想在不同的列中显示每个元素,例如:
name host Date Date
ok.py 172.16.0.161 11:36AM January 07, 2013 2013, 11:36AM 0 bytes
我尝试在模板中使用简单的 for 循环:
{% for i in query %}
{{ i }}
{% endfor %}
这将检索所有元素,例如:
ok.py 172.16.0.161 January 07, 2013, 11:36AM January 07, 2013, 11:36AM 0 bytes
hello.py 172.16.0.161 January 07, 2013, 11:36AM January 07, 2013, 11:36AM 0 bytes
如何在不同的列中向用户展示它们?