title: How to create random slug in Django
body: <p>I have a Django app that will create a contract between two people. The <code>user</code> creates the contract and, upon creation, a random url-safe string is generated using <code>secrets</code>. </p>
  
  <p>However, when I create more than one instance of a <code>Contract</code>, the slugs are the same. The only way to get a different randomly generated string is to restart my server. What am I doing wrong?</p>
  
  <p>Here's the part that matters in my <code>models.py</code></p>
  
  <pre class="lang-py prettyprint-override"><code>    slug = models.SlugField(
          default=secrets.token_urlsafe(64),
          editable=False,
          blank=False
      )
  </code></pre>
  
  <p>Here are the last three <code>Contracts</code> I created. Changing the values of the other fields doesn't change the slug.</p>
  
  <pre><code>    {
          "model_email": "POOP@pooop.com",
          "shoot_location": "Atlanta, GA",
          "shoot_date": "2020-05-24",
          "model_name": "",
          "created_at": "2020-05-24T19:24:20.220845Z",
          "sent_completed_to_model": null,
          "sent_completed_to_photographer": null,
          "photographer": 1,
          "signed": false,
          "slug": "Dqyk5-kDzE219_-abRKABETRuOCGOBxzvFVrXZaUGEe8ZLva6i6tdwUYMksSvKJ_BEABV_Vt1H_ttZ6p-yzRyg"
      },
      {
          "model_email": "POOP@pooop.com",
          "shoot_location": "Atlanta, GA",
          "shoot_date": "2020-05-24",
          "model_name": "",
          "created_at": "2020-05-24T19:24:21.216218Z",
          "sent_completed_to_model": null,
          "sent_completed_to_photographer": null,
          "photographer": 1,
          "signed": false,
          "slug": "Dqyk5-kDzE219_-abRKABETRuOCGOBxzvFVrXZaUGEe8ZLva6i6tdwUYMksSvKJ_BEABV_Vt1H_ttZ6p-yzRyg"
      },
      {
          "model_email": "POOP@pooop.com",
          "shoot_location": "Atlanta, GA",
          "shoot_date": "2020-05-24",
          "model_name": "",
          "created_at": "2020-05-24T19:24:22.120845Z",
          "sent_completed_to_model": null,
          "sent_completed_to_photographer": null,
          "photographer": 1,
          "signed": false,
          "slug": "Dqyk5-kDzE219_-abRKABETRuOCGOBxzvFVrXZaUGEe8ZLva6i6tdwUYMksSvKJ_BEABV_Vt1H_ttZ6p-yzRyg"
      }
  </code></pre>