开发者

render a CharField as checkbox in Django admin?

开发者 https://www.devze.com 2023-03-24 19:43 出处:网络
Is it possible to render a Django model CharField as a checkbox? I need t开发者_如何学运维his checkbox on admin edit page as well as the list_editable list page. E.g. when checked, set this CharField

Is it possible to render a Django model CharField as a checkbox? I need t开发者_如何学运维his checkbox on admin edit page as well as the list_editable list page. E.g. when checked, set this CharField value to 't', else set it to 'n'


You can do a form changing the widgets no matter the type you are using. Here is the documentation

Then if you need to change other things depending on the input people gives I guess you should do some jQuery creating a $('#mycheckboxid').click function

0

精彩评论

暂无评论...
验证码 换一张
取 消