开发者

render a CharField as checkbox in Django admin?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜