Reputation: 35
In the application the user has the option of downloading the paper that is stored in the media folder within the app's directory. Now how do I get the option of downloading that paper working. The present code that I've provided below takes me to the URL from the current html page -
http://127.0.0.1:8000/authorViewSubmission/papers/some.pdf
The actual file is stored in media/papers/some.pdf
Can someone tell me how do i get the download link working here?
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
MEDIA_URL = '/media/'
<td><a href ="{{ MEDIA_URL}}{{i.paper.url}}" class="btn btn btn-success" role="button">Download Paper</a></td>
Upvotes: 2
Views: 1016
Reputation: 2263
To have a proper answer: {{ i.paper.url }}
should be enough to get the full url.
Upvotes: 2