title: Making initialized foreign key field as read-only in the form
body: <p>I have a foreign key field in my form, initialized with:</p>
  
  <pre><code>form=myform(intial= {'val':abc.objects.get(pk=id)})
  </code></pre>
  
  <p>I have tried the following set of codes individually to make the field "val" as a read only value.</p>
  
  <pre><code>form.fields['val'].widget = forms.HiddenInput()
  form.fields['val'].widget.attrs['readonly'] = True
  form.fields['val'].widget.attrs['disabled'] = True
  form.fields['val'].widget.attrs['disabled'] = 'disabled'
  form.fields['val'].widget.attrs['disabled'] = False
  form.fields['val'].widget.attrs['display_only'] = True
  form.fields['val'].widget.attrs['editable'] = False
  </code></pre>
  
  <p>Only <code>HiddenInput</code> worked but it didn't show the field in the form, while <code>disabled</code> showed an error. <code>readonly</code> worked on all fields except the foreign key field.</p>