在Django模板中使用动态量的输入形成形式
问题的症结在于: 我有一个架构,后来将转换为 .csv 文件。但是,我需要用数据填充此模式。为此,我需要具有字段的列(名称,数据类型,订单等) 但是我不知道有多少列 架构 因此,措辞听起来像这样:创建一个具有动态数量列的形式。
当我写这个问题时,我有一个想法在数据库中创建一个“ 方案”表,并绑定了一个表 - “ column” 因此,当您单击“添加列”时,将出现一个新实例,该实例将已经绑定到此架构。 我是在思考正确的方向还是还有另一个主意? 下图将使您更准确地传达问题的本质。 先感谢您
The crux of the problem is this:
I have a Schema that will later be converted to a .csv file. However, I need to populate this schema with data. To do this, I need columns that will have fields (Name, data type, order, etc.)
But I don't know how many columns the Schema will have
Therefore, the wording sounds like this: Create a form with a dynamic number of columns.
While I was writing the question, I had an idea to create a "Scheme" table in the database and bind a table - "Column" to it
Thus, when you click "add column", a new instance will appear that will already be bound to this Schema.
Am I thinking in the right direction or do you have another idea?
The picture below will allow you to convey the essence of the problem more accurately.
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我处于您的位置,我将使用
htmx
。因此,当按下“添加列”按钮时,将会出现新的行。从我对您的帖子的理解来看,我也会以相反的方式进行操作,我会将列绑定到这样的方案
If I was in your position, I would utilize
HTMX
. With that, when the "add column" button would be pressed, a new row would appear.I would also do it the other way around from what I understand of your post, I would bind the column to the scheme like this