Почему эта функция загружает всю веб-страницу?
views.py
def download_file(request,path):
file_path=os.path.join(settings.MEDIA_ROOT,path)
if os.path.exists(file_path):
with open(file_path, 'rb') as enm:
response=HttpResponse(enm.read(),content_type="application/adminupload")
response['Content-Disposition']='Inline;filename='+os.path.basename(file_path)
return response
шаблон index.html
<div>
{% for post in file %}
<h2>{{post.title}}</h2>
<a href="{{post.admin.upload.url}}" class="home__button anime-text" download="{{post.admin.upload.url}}">DOWNLOAD CV</a>
{% endfor %}
</div>
urls.py
re_path(r'^download/(?P<path>.*)$',serve,{'document_root':settings.MEDIA_ROOT}),
Я пытаюсь загрузить файл pdf, когда я нажимаю кнопку загрузки, функция загружает веб-страницу и сохраняет ее с расширением (.htm)