def get_context_override(self, request):
        """
        Override the request object with an emulated user.
        """
        context_override = super(EmulateUserModelMixin, self).get_context_override(request)
        try:
            if request.user.is_staff:
                user = self.UserModel.objects.get(pk=request.session['emulate_user_id'])
                context_override.update(user=user)
        except (self.UserModel.DoesNotExist, KeyError):
            pass
        return context_override
Override the request object with an emulated user.