html 中只读的 django 小部件字段
django widget fields readonly in html
我正在尝试使用只能在 html 模板中读取的字段,例如使用小部件 include
{% include "bases/fields.html" with field=form_sales.idsale %}
不显示只读 属性 如果我使用
|is_readonly=true
谁能帮帮我?
首先,在模板的开头建立这一行:
{% load widget_tweaks %}
然后,像这样使用它:
{% include "bases/fields.html" with field=form_sales.idsale|attr:"readonly:True" %}
应该就可以了
我正在尝试使用只能在 html 模板中读取的字段,例如使用小部件 include
{% include "bases/fields.html" with field=form_sales.idsale %}
不显示只读 属性 如果我使用
|is_readonly=true
谁能帮帮我?
首先,在模板的开头建立这一行:
{% load widget_tweaks %}
然后,像这样使用它:
{% include "bases/fields.html" with field=form_sales.idsale|attr:"readonly:True" %}
应该就可以了