Fixed lazy-loading of related non-loaded models

Patch for ticket #20143, see https://code.djangoproject.com/ticket/20143.