html不发送帖子以查看

问题描述 投票:1回答:1

我有一个提交表单,例如:

<div class="form-group">
    <div class="checkbox">
        <label for="id_active_state">
            <div class="icheckbox_square-red checked" style="position: relative;">
                <input type="checkbox" name="active_state" class="" id="id_active_state" checked=""><ins class="iCheck-helper"></ins>
            </div> active</label>
    </div>
</div>
<div class="form-group">

    <div class="button_holder">
        <button type="submit" name="submit" class="btn btn-primary" value="send">
            submit
        </button>
    </div>

</div>

并且应该在视图中处理:

def special_offer_edit_view(http_request):
    action_verbose_name = 'the_view'
    special_offer_id = http_request.GET.get('id')
    special_offer_obj = SpecialOffer.objects.filter(id=special_offer_id)
    for data in special_offer_obj:
        sp_obj = {'active_state': data.active_state}

    if http_request.method == 'POST':
        print('hi')

    return render(...)

会引发503错误,并且不会发送“ POST”方法和数据。它有什么问题?

python html django post django-views
1个回答
1
投票
您的输入应通过您以其他方式指定的元素名称active_state访问
© www.soinside.com 2019 - 2024. All rights reserved.