Fixed #21587 -- Raised deprecation warnings correctly.
Fixed #23923 -- Promoted Django's deprecation warnings to errors in runtests.py
Tried to fix some warnings.