def reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra):
    """
    If versioning is being used then we pass any `reverse` calls through
    to the versioning scheme instance, so that the resulting URL
    can be modified if needed.
    """
    scheme = getattr(request, 'versioning_scheme', None)
    if scheme is not None:
        try:
            url = scheme.reverse(viewname, args, kwargs, request, format, **extra)
        except NoReverseMatch:
            # In case the versioning scheme reversal fails, fallback to the
            # default implementation
            url = _reverse(viewname, args, kwargs, request, format, **extra)
    else:
        url = _reverse(viewname, args, kwargs, request, format, **extra)

    return preserve_builtin_query_params(url, request)
def reverse ( viewname , args = None , kwargs = None , request = None , format = None , ** extra ) : scheme = getattr ( request , 'versioning_scheme' , None ) if scheme is not None : try : url = scheme . reverse ( viewname , args , kwargs , request , format , ** extra ) except NoReverseMatch : url = _reverse ( viewname , args , kwargs , request , format , ** extra ) else : url = _reverse ( viewname , args , kwargs , request , format , ** extra ) return preserve_builtin_query_params ( url , request )
If versioning is being used then we pass any `reverse` calls through
    to the versioning scheme instance, so that the resulting URL
    can be modified if needed.