title: Change a Django form field to a hidden field
body: <p>I have a Django form with a <code>RegexField</code>, which is very similar to a normal text input field.</p>
  
  <p>In my view, under certain conditions I want to hide it from the user, and trying to keep the form as similar as possible. What's the best way to turn this field into a <code>HiddenInput</code> field?</p>
  
  <p>I know I can set attributes on the field with:</p>
  
  <pre><code>form['fieldname'].field.widget.attr['readonly'] = 'readonly'
  </code></pre>
  
  <p>And I can set the desired initial value with:</p>
  
  <pre><code>form.initial['fieldname'] = 'mydesiredvalue'
  </code></pre>
  
  <p>However, that won't change the form of the widget.</p>
  
  <p>What's the best / most "django-y" / least "hacky" way to make this field a <code>&lt;input type="hidden"&gt;</code> field?</p>