django - 在 django 表中使用字段作为行
问题描述
我正在使用 django_tables2 库,但在文档中没有看到将字段用作行而不是列。
class PizzaTable(tables.Table):
class Meta:
model = PizzaInstance
fields = ("pizza", "type", "size", "price")
attrs = {"class": "mytable"}
试图在一行下显示两个实例,如下所示:
small large
cheese $1 $2
instead of
cheese small $1
cheese large $2
我可以在 django_tables2 库中使用比萨饼和类型作为行吗?
解决方案
推荐阅读
- rust - 将值从向量移动到预定义切片的惯用方式?
- python - 如何根据特定的颜色轮廓或边框找到轮廓?
- typescript - 无法使用打字稿启动博览会裸工作流程
- python - Django 模型 FileField 大文件上传
- html - Handel 从 iframe 中另存为
- linux - 为 pdftohtml 选择编码
- node.js - TypeOrm 和 MongoDB:插入/保存时忽略列别名
- github - 访问 Github 工作流的工件
- html - 如何使文本与文本输入字段的左上角对齐?
- openstack - 使用 qcow2 映像时无法创建 Cinder 卷。Openstack/Packstack