download working well
This commit is contained in:
parent
d1f41dcd38
commit
a0ef3cff8d
Binary file not shown.
Binary file not shown.
BIN
misdghs/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
misdghs/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
misdghs/__pycache__/settings.cpython-313.pyc
Normal file
BIN
misdghs/__pycache__/settings.cpython-313.pyc
Normal file
Binary file not shown.
BIN
misdghs/__pycache__/urls.cpython-313.pyc
Normal file
BIN
misdghs/__pycache__/urls.cpython-313.pyc
Normal file
Binary file not shown.
BIN
misdghs/__pycache__/wsgi.cpython-313.pyc
Normal file
BIN
misdghs/__pycache__/wsgi.cpython-313.pyc
Normal file
Binary file not shown.
BIN
resulation/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
resulation/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
resulation/__pycache__/admin.cpython-313.pyc
Normal file
BIN
resulation/__pycache__/admin.cpython-313.pyc
Normal file
Binary file not shown.
BIN
resulation/__pycache__/apps.cpython-313.pyc
Normal file
BIN
resulation/__pycache__/apps.cpython-313.pyc
Normal file
Binary file not shown.
BIN
resulation/__pycache__/models.cpython-313.pyc
Normal file
BIN
resulation/__pycache__/models.cpython-313.pyc
Normal file
Binary file not shown.
BIN
resulation/__pycache__/urls.cpython-313.pyc
Normal file
BIN
resulation/__pycache__/urls.cpython-313.pyc
Normal file
Binary file not shown.
BIN
resulation/__pycache__/views.cpython-313.pyc
Normal file
BIN
resulation/__pycache__/views.cpython-313.pyc
Normal file
Binary file not shown.
BIN
resulation/migrations/__pycache__/0001_initial.cpython-313.pyc
Normal file
BIN
resulation/migrations/__pycache__/0001_initial.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
resulation/migrations/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
resulation/migrations/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
@ -13,8 +13,7 @@ urlpatterns = [
|
|||||||
path('viewresulation/', resulation.views.Viewresulation, name='viewresulation'),
|
path('viewresulation/', resulation.views.Viewresulation, name='viewresulation'),
|
||||||
path('deed/', resulation.views.Contract, name='deed'),
|
path('deed/', resulation.views.Contract, name='deed'),
|
||||||
path('mou/', resulation.views.Mou, name='mou'),
|
path('mou/', resulation.views.Mou, name='mou'),
|
||||||
re_path('downloads/<int:attendance_id>/<str:filename>', resulation.views.file_download, name='file-download'),
|
path('<str:type>/<str:filename>', resulation.views.file_download, name='file-download'),
|
||||||
path('rcm/downloads/<int:attendance_id>/<str:filename>', resulation.views.file_download, name='file-download'),
|
|
||||||
path('rcm/', resulation.views.file_download, name='download_file'),
|
path('rcm/', resulation.views.file_download, name='download_file'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -77,9 +77,13 @@ def Viewresulation(request):
|
|||||||
return render(request, 'resulation/viewresulation.html', {'pdf_records': pdf_records})
|
return render(request, 'resulation/viewresulation.html', {'pdf_records': pdf_records})
|
||||||
|
|
||||||
|
|
||||||
def file_download(request, attendance_id, filename):
|
def file_download(request, type, filename):
|
||||||
# Construct the full path to the file
|
# Construct the full path to the file
|
||||||
file_path = os.path.join(settings.MEDIA_ROOT, 'attendance_files', filename)
|
if type== 'attendance':
|
||||||
|
file_path = os.path.join(settings.MEDIA_ROOT, 'attendance_files', filename)
|
||||||
|
if type=='resolution':
|
||||||
|
file_path = os.path.join(settings.MEDIA_ROOT, 'resolution_files', filename)
|
||||||
|
|
||||||
|
|
||||||
# Use sendfile to stream the file directly
|
# Use sendfile to stream the file directly
|
||||||
return FileResponse(open(file_path, 'rb'), content_type='application/pdf')
|
return FileResponse(open(file_path, 'rb'), content_type='application/pdf')
|
||||||
|
@ -35,11 +35,11 @@
|
|||||||
<td>{{ record.m_date|date:"d M Y" }}</td>
|
<td>{{ record.m_date|date:"d M Y" }}</td>
|
||||||
<td>{{ record.m_venue }}</td>
|
<td>{{ record.m_venue }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{% url 'file-download' attendance_id=record.eid filename=record.attendance_file %}">Download</a>
|
<a href="{% url 'file-download' type="attendance" filename=record.attendance_file %}">Download</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if record.res_con_mou_file %}
|
{% if record.res_con_mou_file %}
|
||||||
<a href="{{ record.res_con_mou_file.url }}">Download</a>
|
<a href="{% url 'file-download' type="resolution" filename=record.res_con_mou_file %}">Download</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user