a

Selector and checkbox widgets

These widgets make use of the HTML elements <select><input type="checkbox">, and<input type="radio">.

Widgets that render multiple choices have an option_template_name attribute that specifies the template used to render each choice. For example, for the Select widget,select_option.html renders the <option> for a <select>.

CheckboxInput

class CheckboxInput[source]
  • input_type'checkbox'
  • template_name'django/forms/widgets/checkbox.html'
  • Renders as: <input type="checkbox" ...>

Takes one optional argument:

check_test

A callable that takes the value of the CheckboxInput and returns True if the checkbox should be checked for that value.

posted @ 2018-04-01 13:27  十年闷油瓶  阅读(97)  评论(0编辑  收藏  举报