我有一个提交表单,例如:
<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”方法和数据。它有什么问题?
active_state
访问