Fixed #21832 -- Updated prompt, tests, and docs to show that USERNAME_FIELD supports FK. Refactored code to allow overriding for custom behaviour.

Thanks Chris and Tim Graham for review.