django框架入门与解读 (五)-django问题梳理

1.创建model尽量提前确定字段类型,后续网页输入错误自带,错误提示而不是代码error。免去了捕获的编写

2. id 复选框,多选

<th><input type="checkbox" name="check_box"></th>
<td align="center"><input type="checkbox" name="check_box_list"></td>

3.button 修改 状态信息 html

<td>
    {% if row.status == 4 %}
        <div>
            <button type="button" class="btn btn-info btn-xs rep-row" nid="{{ row.id }}" >xxxxx</button>
        </div>
    {% else %}
        <div>
            <button type="button" class="btn btn-info btn-xs rep-row " nid="{{ row.id }}" disabled="disabled">
                xxxxx
            </button>
        </div>
    {% endif %}
</td>
bindReport();
function bindReport() {
    $('#tb').on('click', '.rep-row', function ()
    {
        var rowId = $(this).attr('nid');
        $.ajax({
            url: '/xxxxx.html',
            type: 'GET',
            data: {'nid': rowId},
            success: function (arg) {
                var dict = JSON.parse(arg);
                if (dict.status) {
                    window.location.reload();
                }
            }
        })
    });
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值