title: How do I get Django to not add carriage returns in a Textarea in the admin UI?
body: <p>I am using a Textarea in Django admin with strip=False as outlined <a href="https://stackoverflow.com/a/69094809">here</a>.</p>
  <pre><code>def formfield_for_dbfield(self, db_field, **kwargs):
      formfield = super().formfield_for_dbfield(db_field, **kwargs)
      if db_field.name == 'some_text':
          formfield.strip = False
          formfield.widget = forms.Textarea(attrs={'rows': 10, 'cols': 80})
      return formfield
  </code></pre>
  <p>The DB field comes from an HTML input box, and has newlines in it (\n).</p>
  <p>After I edit and save in Django, it has carriage-return newlines (\r\n), as seen when I query from the DB.</p>
  <p>BEFORE:</p>
  <pre><code>select md5(some_text), some_text from myapp_obj where id = 328;
                 md5                |                         some_text                          
  ----------------------------------+-----------------------------------------------------------
   adb48a782562ef02801518c4e94ca830 | foo1.                                             +
                                    | foo2                                              +
  ...   
  </code></pre>
  <p>AFTER:</p>
  <pre><code>select md5(some_text), some_text from myapp_obj where id = 328;
                 md5                |                         some_text                          
  ----------------------------------+-----------------------------------------------------------
   e9e06c1d9764be70fc61f05c5fd6292c | foo1.\r                                             +
                                    | foo2\r                                              +
  ...   
  </code></pre>
  <p>How do I get the Django admin UI (the Textarea) to save back exactly what was loaded into its UI, without adding or subtracting anything?</p>
  <p>I'm using Django 3.2.9, Postgres 13.</p>