document file ID

Questions, comments, discussions. Over time certain topics might be moved to their own category.
Post Reply
gtrot
Posts: 26
Joined: Tue Oct 01, 2019 9:03 pm

document file ID

Post by gtrot »

Greetings,

I can get the document pk with :

Code: Select all

{{ document.pk }}
But Is it possible to obtain the identifier (pk) or the downloard URL of the last document file via the template function?

Regards,

Guillaume
User avatar
michael
Developer
Developer
Posts: 277
Joined: Sun Apr 19, 2020 6:21 am

Re: document file ID

Post by michael »

Hello,

Yes it is possible. You can resolve the URL by calling the {% url %} template tag, pass the arguments view name ("documents:document_file_download") and document file ID (document.file_latest.pk).

Code: Select all

{% url 'documents:document_file_download' document.file_latest.pk %}
Cheers!
Post Reply