File tree Expand file tree Collapse file tree 2 files changed +13
-21
lines changed
Expand file tree Collapse file tree 2 files changed +13
-21
lines changed Original file line number Diff line number Diff line change @@ -15,18 +15,6 @@ def index(request):
1515 # Page from the theme
1616 return render (request , 'pages/dashboard.html' , context = context )
1717
18- # def get_files_from_directory(directory_path):
19- # files = []
20- # for root, _, filenames in os.walk(directory_path):
21- # for filename in filenames:
22- # file_path = os.path.join(root, filename)
23- # files.append({
24- # 'file': file_path.split('/media/')[1],
25- # 'filename': filename,
26- # 'file_path': file_path
27- # })
28- # return files
29-
3018def get_files_from_directory (directory_path ):
3119 files = []
3220 for filename in os .listdir (directory_path ):
Original file line number Diff line number Diff line change 1515 < div class ="col-lg-3 border py-2 ">
1616 < nav aria-label ="breadcrumb ">
1717 < ol class ="breadcrumb ">
18- {% for breadcrumb in breadcrumbs %}
19- {% if forloop.last %}
20- < li class ="breadcrumb-item active " aria-current ="page "> {{ breadcrumb.name }}</ li >
21- {% else %}
22- < li class ="breadcrumb-item "> < a href ="{{ breadcrumb.url }} "> {{ breadcrumb.name }}</ a > </ li >
23- {% endif %}
24- {% endfor %}
18+ {% for breadcrumb in breadcrumbs %}
19+ {% if forloop.last %}
20+ < li class ="breadcrumb-item active " aria-current ="page "> {{ breadcrumb.name }}</ li >
21+ {% else %}
22+ < li class ="breadcrumb-item "> < a href ="{{ breadcrumb.url }} "> {{ breadcrumb.name }}</ a > </ li >
23+ {% endif %}
24+ {% endfor %}
2525 </ ol >
2626 </ nav >
2727 < ul class ="">
6767 < video height ="170px " data-bs-toggle ="modal " data-bs-target ="#file-{{forloop.counter}} " class ="w-100 "
6868 src ="/media/{{ file.file }} "> </ video >
6969 {% else %}
70- < object data =" /media/{{ file.file }} " type =" application/pdf " width =" 100% " height =" 170px " >
70+ {% if file.file|file_extension in ".csv, .txt" %}
7171 < a href ="/media/{{ file.file }} "> {{ file.filename }}</ a >
72- </ object >
72+ {% elif file.file|file_extension == '.pdf' %}
73+ < object class ="d-block " data ="/media/{{ file.file }} " type ="application/pdf " width ="100% " height ="170px ">
74+ < a href ="/media/{{ file.file }} "> {{ file.filename }}</ a >
75+ </ object >
76+ {% endif %}
7377 {% endif %}
7478 <!-- Modal -->
7579 < div class ="modal fade " id ="file-{{forloop.counter}} " data-bs-backdrop ="static " data-bs-keyboard ="false "
You can’t perform that action at this time.
0 commit comments