This is needed to support custom user models which don't define a manager named `objects`. Backport of cc4de61a from master.