Reorganized the database test settings

Change database test settings from "TEST_"-prefixed entries in the
database settings dictionary to setting in a dictionary that is itself
an entry "TEST" in the database settings.

Refs #21775

Thanks Josh Smeaton for review.
Fix weird autodetector error
Corrected a few missed references to old test settings
Fixed test breakage following test-settings enhancements
Avoided leaking warning filters.
Removed obsolete hack to run template tests.
Fixed the last fix for database test settings to work with Python3.
Revert "Reordered INSTALLED_APPS in default template, refs #22005"

This reverts commit a718fcf201b04ba254e9073be82f51ae1ae3a853.
Prevented admin from importing auth.User.

Since we don't enforce order between apps, root packages of contrib apps
cannot import models from unrelated apps.

Fix #22005, refs #21719.
Fixed an example to match the code.
Substituted 'shortcut function' for 'factory method' in tutorial

Many newbies don't know what a factory method is, nor is it pertinent to the
information the tutorial hopes to convey.
Fixed #22237 -- Removed some warnings in the test suite

Thanks Aymeric Augustin for the report.
Fixed #22239 -- Add auto detection of renamed models
Merge pull request #2415 from SmileyChris/migration-renamed-models

Fixed #22239 -- Add auto detection of renamed models