Log the exception if debug logging is enabled for django_orm module
Added short variable reference to deep dictionary
Switched Django ORM queries to use a ValuesQuerySet

This allows fetching values through foreign keys using the double-under
Django lookup syntax.
Merge pull request #8471 from whiteinge/django_orm-enhancements

Django orm enhancements