Internal Server Error: /admin/accounts/customuser/23/change/
Traceback (most recent call last):
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\contrib\admin\options.py", line 688, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\utils\decorators.py", line 134, in _wrapper_view
response = view_func(request, *args, **kwargs)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\views\decorators\cache.py", line 62, in _wrapper_view_func
response = view_func(request, *args, **kwargs)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\contrib\admin\sites.py", line 242, in inner
return view(request, *args, **kwargs)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\contrib\admin\options.py", line 1889, in change_view
return self.changeform_view(request, object_id, form_url, extra_context)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\utils\decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\utils\decorators.py", line 134, in _wrapper_view
response = view_func(request, *args, **kwargs)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\contrib\admin\options.py", line 1747, in changeform_view
return self._changeform_view(request, object_id, form_url, extra_context)
File "C:\Users\goyo\Documents\django\my_hospital\.venv_my_hospital\lib\site-packages\django\contrib\admin\options.py", line 1855, in _changeform_view
"subtitle": str(obj) if obj else None,
TypeError: __str__ returned non-string (type NoneType)
[03/May/2023 09:03:04] "POST /admin/accounts/customuser/23/change/ HTTP/1.1" 500 117634
The moment of raising the error is this: when I add the user in the first form everything seems to be ok:
then, when I add a few data in the change form and save the changes the error raises: