@decorators.api_view(['GET'])
@decorators.permission_classes((permissions.AllowAny,))
@decorators.renderer_classes((JSONRenderer,))
def cname(request):
 host = request.GET.get('host')
 if (not host):
  return Response({'error': 'host GET arg required'}, status=status.HTTP_400_BAD_REQUEST)
 host = clean_url(host)
 slug = cname_to_slug(host)
 return Response({'host': host, 'slug': slug})

@ decorators . api_view ( [ 'GET' ] ) @ decorators . permission_classes ( ( permissions . AllowAny , ) ) @ decorators . renderer_classes ( ( JSONRenderer , ) ) def cname ( request ) : host = request . GET . get ( 'host' ) if ( not host ) : return Response ( { 'error' : 'host GET arg required' } , status = status . HTTP_400_BAD_REQUEST ) host = clean_url ( host ) slug = cname_to_slug ( host ) return Response ( { 'host' : host , 'slug' : slug } )
get the slug that a particular hostname resolves to .