2013-05-09 3 views

답변

0

뷰에 순수 파이썬 구현이 필요하거나이를 수행하기 위해 고유 한 템플릿 태그를 작성하십시오.

기본적으로 당신 같은 후 : 아마도이 같은

import os 

def your_view(r): 
    path = '/absolute/path/to/dir/' 
    files = [f for f in os.listdir(path) if os.path.isfile(
     os.path.join(path, f))] 
    return render(request, 'path/to/template.html', { 
     'files': files}) 

뭔가?

템플릿 태그에서 유사한 방법을 사용할 수 있습니다.

관련 문제