chelseaNB1 2022-12-09 13:20 采纳率: 86.2%
浏览 63
已结题

请问django中怎么把表格中的数据从前端传递到后端

如题,这是html界面,我想把这个表格中的数据给传递到后端进行处理

<form method="post" action="/sr/bi" name="table">
            {% csrf_token %}
            <table class="table table-bordered" id="zzz">
            <thead>
            <tr>
                <th>R400</th>
                <th>R401</th>
                <th>R402</th>
            </tr>
            </thead>
            <tbody id="tb">
            {% for item in obj %}
            <tr>
                <td>{{ item.r400 }}</td>
                <td>{{ item.r401 }}</td>
                <td>{{ item.r402 }}</td>
            </tr>
            {% endfor %}
            </tbody>
            </table>
            <button type="submit" class="btn btn-primary" style="margin-left:15%;">提 交</button>
        </form>

这是后端代码,我想接收到数据后先打印一下,结果得到的是 [ ] 空列表

def sb(request):
    hhh = request.POST.getlist('table')
    print(hhh)
    return HttpResponse('???')

请问应该怎么办

  • 写回答

4条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      问题事件

      • 系统已结题 2月3日
      • 已采纳回答 1月26日
      • 创建了问题 12月9日

      悬赏问题

      • ¥100 IIC通讯数据算法分析
      • ¥15 matlab 绘制涡流场
      • ¥15 依存句法分析如何与BERT模型及GCN相结合
      • ¥66 有偿收一个会Python 与unitysocket通信,会简单mediapipe手势识别的哥
      • ¥15 药店卖药设计使利润最大
      • ¥15 模拟银行实现VIP服务
      • ¥20 ECU在实车上can通讯失败或不稳定
      • ¥15 关于VB.net调用Excel如何打包的问题?
      • ¥15 VB6.0+WebBrowser如何实现网页内嵌图片按钮点击
      • ¥30 请问纯C语言如何编写简易的easyx图形库