@decorators.api_view(['GET'])
@decorators.permission_classes((permissions.AllowAny,))
@decorators.renderer_classes((JSONRenderer,))
def docurl(request):
 project = request.GET.get('project')
 version = request.GET.get('version', LATEST)
 doc = request.GET.get('doc', 'index')
 if (project is None):
  return Response({'error': 'Need project and doc'}, status=status.HTTP_400_BAD_REQUEST)
 project = get_object_or_404(Project, slug=project)
 version = get_object_or_404(Version.objects.public(request.user, project=project, only_active=False), slug=version)
 return Response({'url': make_document_url(project=project, version=version.slug, page=doc)})

@ decorators . api_view ( [ 'GET' ] ) @ decorators . permission_classes ( ( permissions . AllowAny , ) ) @ decorators . renderer_classes ( ( JSONRenderer , ) ) def docurl ( request ) : project = request . GET . get ( 'project' ) version = request . GET . get ( 'version' , LATEST ) doc = request . GET . get ( 'doc' , 'index' ) if ( project is None ) : return Response ( { 'error' : 'Need project and doc' } , status = status . HTTP_400_BAD_REQUEST ) project = get_object_or_404 ( Project , slug = project ) version = get_object_or_404 ( Version . objects . public ( request . user , project = project , only_active = False ) , slug = version ) return Response ( { 'url' : make_document_url ( project = project , version = version . slug , page = doc ) } )
get the url that a slug resolves to .