【发布时间】:2016-12-02 14:58:09
【问题描述】:
I have a modelform with readonly fields that render as a HTML input widget with an ugly 'no-entry' mouseover image (firefox) when the text inside the input box is selected - default behaviour for 'models.TextField' fields to我相信渲染为输入。
self.fields['project_path'].widget.attrs['readonly'] = True
self.fields['media_path'].widget.attrs['readonly'] = True
self.fields['responsible'] = SysEventChoiceField(User.objects.all().order_by('first_name'))
我想将混合了只读字段的模型表单呈现为纯文本,而表单中没有输入框。结果在 html 中应该看起来像这样。
<p>D:\This\Path</p>
<p>E:\This\other\path</p>
<input value="Bob Smith" name="user"></input>
【问题讨论】: