def redirect_to(request, url, permanent=True, query_string=False, **kwargs):
    args = request.META.get('QUERY_STRING', '')

    if url is not None:
        if kwargs:
            url = url % kwargs

        if args and query_string:
            url = "%s?%s" % (url, args)

        klass = permanent and HttpResponsePermanentRedirect or HttpResponseRedirect
        return klass(url)
    else:
        logger.warning('Gone: %s', request.path,
                    extra={
                        'status_code': 410,
                        'request': request
                    })
        return HttpResponseGone()
Simple generic pagination.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/views/generic/simple.py/redirect_to--crossover with--dataset/ETHPy150Open edgewall/trac/trac/util/presentation.py/paginate