0

I have an object that contains a database record that has a FileField which points to a .pdf, .txt or .doc or .docx.

In my django template i want to create a link which when clicked opens the file, in the machines default tool for opening that file, How do i do this?

I currently have:

<a href="#">{{ object.file.name }}</a>

I would like to click this link and have the document opened.

Jan Sršeň
  • 1,045
  • 3
  • 23
  • 46
eb0t
  • 127
  • 1
  • 11

0 Answers0