AttributeError: 'User' object has no attribute 'pk'

Hello, I tried going to the built-in admin panel, and I got this error:

Traceback (most recent call last):
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\handlers\base.py", line 202, in _get_response
    response = response.render()
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\response.py", line 105, in render
    self.content = self.rendered_content
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\response.py", line 83, in rendered_content
    return template.render(context, self._request)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\backends\django.py", line 61, in render
    return self.template.render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 170, in render
    return self._render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 162, in _render
    return self.nodelist.render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 162, in _render
    return self.nodelist.render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 162, in _render
    return self.nodelist.render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\leroy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\contrib\admin\templatetags\log.py", line 20, in render
    user_id = context[self.user].pk
AttributeError: 'User' object has no attribute 'pk'

Are you following some type of tutorial, or are you working on something custom? If you’re working through a tutorial, what tutorial are you following?

What have you done up to this point?

This is something custom. It all the sudden started happening today.