Fix AttributeError on Ajax calls with expired session

When the session expires and horizon does an Ajax call (for example,
to get a modal window), an exception is raised instead of redirecting
to the login screen, because the exception handler in the horizon
middleware doesn't add the "horizon" attribute to the request. This is
a very simple fix to avoid throwing the exception.

Change-Id: I663999dd616b1a4fa3292615eecf3cc44c3e808a
Closes-bug: #1224458
Use a @cached_property decorator

Instead of using an ugly code that uses __dict__ or hasattr,
use a @cached_property decorator that encapsulates the
property caching logic in a single place and makes it easier
to later replace with better caching techniques.

Re-use the cached_property from django.

Change-Id: I9e3e26cd4a8c7055854e851bc5f062a29981971e
Merge "Fix AttributeError on Ajax calls with expired session"
Merge "Use a @cached_property decorator"