I have a model where each object is conceptually a cell of a table - two ForeignKeys, F
and G
determine its position on the table (i.e., each tuple (f,g)
is linked to one cell). That is, something like that:
我有一个模型,其中每个对象在概念上是一个表格的单元格 - 两个ForeignKeys,F和G确定它在桌面上的位置(即,每个元组(f,g)链接到一个单元格)。就是这样的:
class Cell(models.Model):
f = models.ForeignKey(F)
g = models.ForeignKey(G)
value = models.IntegerField()
When I create an admin page for that model using:
当我使用以下方法为该模型创建管理页面时:
admin.site.register(Cell)
I get a page where each cell must be entered by linking to a foo
, a bar
and setting its val
individually. For huge cells, that becomes cumbersome. It would be much more convenient to edit that information like so:
我得到一个页面,其中必须通过链接到foo,bar并单独设置其val来输入每个单元格。对于巨大的细胞来说,这变得很麻烦。编辑这些信息会更方便:
Where F_
and G_
are objects of the F
and G
models, respectively.
其中F_和G_分别是F和G模型的对象。
Is it possible to get this interface on Django?
是否可以在Django上获得此接口?
1 个解决方案
#1
0
Take a look at django-tables2. I haven't used it but read the docs whilst looking for other functionality and I think it might help you.
看看django-tables2。我没有使用它,但在寻找其他功能的同时阅读文档,我认为它可能对您有所帮助。
Also remembered this video which explains how you can make django work like a spreadsheet which may also be usful to you.
还记得这段视频,它解释了如何使django像电子表格一样工作,这也可能对你有用。
#1
0
Take a look at django-tables2. I haven't used it but read the docs whilst looking for other functionality and I think it might help you.
看看django-tables2。我没有使用它,但在寻找其他功能的同时阅读文档,我认为它可能对您有所帮助。
Also remembered this video which explains how you can make django work like a spreadsheet which may also be usful to you.
还记得这段视频,它解释了如何使django像电子表格一样工作,这也可能对你有用。