[1.7.x] Fixed #21794 -- Removed deprecation warning for abstract models outside an app.

Backport of e7b9a58b081299b30f807d5c66f7a5d1940efe4c from master.