
Django将生成:
<!--same form --><input type="radio" value="good_price"/> <!-- show good price if this is checked --><input type="radio" value="bad_price"/> <!-- show bad price if this is checked --><!--1st -->Good price <input ID="ID_name"..../><input ID="options_with_good_price"/><!--2nd -->Bad Price <input ID="ID_name".../><input ID="options_with_bad_price"/>
所以有重复的HTML ID,如何避免呢? (我可以生存,没有为这两个带有重复ID的盒子生成ID,但不是所有其他盒子)
解决方法 如果你正在使用{{form.element}}
您可以执行以下 *** 作:
{{form.element | attr:“ID:another_name”}}
抱歉没有意识到我使用的模板过滤器:
http://djangosnippets.org/snippets/729/
我刚刚改变了=:
总结以上是内存溢出为你收集整理的python – Django:如何避免在同一表单中两次显示字段的重复html id?全部内容,希望文章能够帮你解决python – Django:如何避免在同一表单中两次显示字段的重复html id?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)