Fixed #23947 -- Django's test suite doesn't pass in reverse order

Fixed inconsistent tests when running Django's test suite with --reverse option.
import can likely go at top of file