def create_or_get_from_request(request):
        """Returns `RequestInfo` instance.

        If object was already created during ``request`` it is
        returned. Otherwise new instance is created with details
        populated from ``request``. New instance is then cached for reuse
        on subsequential calls.
        """
        saved = getattr(request, REQUEST_CACHE_FIELD, None)
        if isinstance(saved, RequestInfo):
            return saved
        req = RequestInfo()
        req.user_ip = request.META.get('REMOTE_ADDR')
        req.user_host = request.META.get('REMOTE_HOST')
        req.user_agent = request.META.get('HTTP_USER_AGENT')
        req.full_path = request.build_absolute_uri(
            request.get_full_path())
        req.method = request.META.get('REQUEST_METHOD')
        req.referer = request.META.get('HTTP_REFERER')
        req.save()
        setattr(request, REQUEST_CACHE_FIELD, req)
        return req
Returns `RequestInfo` instance.

        If object was already created during ``request`` it is
        returned. Otherwise new instance is created with details
        populated from ``request``. New instance is then cached for reuse
        on subsequential calls.