Added check for case where request object is not present in context,
leading to template tag error masking the actuall error upstream in the
view.