Fixed #24007 -- Ensure apps registry's ready before unpickling models

This prevents AppRegistryNotReady errors when unpickling Django
models from an external script.
Code looks okay to me. You might like to add a trailing comma here per our usual style and of course some release notes.