title: TypeError in view: Field expected a number but got SimpleLazyObject
body: <p>I upgraded to django v3.1 and suddenly getting this error:</p>
  <blockquote>
  <p>Field 'id' expected a number but got &lt;SimpleLazyObject: '23'&gt;.</p>
  </blockquote>
  <p>The failing line of code is this:</p>
  <pre><code>my_obj = get_object_or_404(MyModel, pk=kwargs.get('pk'))
  </code></pre>
  <p>Any ideas what I might be doing wrong?</p>
  <p>Thanks!</p>