I just upgraded django from 3.x to 4.x. I am getting error for template not found:
TemplateDoesNotExist at /admin/login/
django/forms/errors/list/default.html
The template is in this location:
./lib/python3.8/site-packages/django/forms/templates/django/forms/errors/list/default.html
Django is trying to look in those locations:
django.template.loaders.filesystem.Loader: ./project/templates/django/forms/errors/list/default.html (Source does not exist)
django.template.loaders.app_directories.Loader: ./lib/python3.8/site-packages/django/contrib/admin/templates/django/forms/errors/list/default.html (Source does not exist)
django.template.loaders.app_directories.Loader: ./lib/python3.8/site-packages/django/contrib/auth/templates/django/forms/errors/list/default.html (Source does not exist)
django.template.loaders.app_directories.Loader: ./project/android/templates/django/forms/errors/list/default.html (Source does not exist)
django.template.loaders.app_directories.Loader: ./project/webapp/templates/django/forms/errors/list/default.html (Source does not exist)
django.template.loaders.app_directories.Loader: ./lib/python3.8/site-packages/oauth2_provider/templates/django/forms/errors/list/default.html (Source does not exist)
django.template.loaders.app_directories.Loader: ./lib/python3.8/site-packages/rest_framework/templates/django/forms/errors/list/default.html (Source does not exist)
django.template.loaders.app_directories.Loader: ./lib/python3.8/site-packages/debug_toolbar/templates/django/forms/errors/list/default.html (Source does not exist)
django.template.loaders.app_directories.Loader: ./lib/python3.8/site-packages/ajax_select/templates/django/forms/errors/list/default.html (Source does not exist)
So obviously, django is not even looking into it's own django.forms directory and I cannot figure out why. Is there some new settings on 4.x, that I am missing?
Edit:
It is caused in all places, where there's a form and form.non_field_errors is called, because returned ErrorList class is using this template.