PTB
PTB

Reputation: 1

How to count download hit in Django admin

I am newbie for Django admin. I have made little site where I am giving option to user to upload some mp3 files.for that I am using Django file upload. I have html page for showing all those files where I have option to download it by clicking on download symbol. I want to count on every download. I have added filed in my table to keep it's record.

My html file where I want to count hit.

<th scope="row" style="vertical-align: middle;">
     <a href="{{radio_file.audio_file.url}}" download >
     <i class="fas fa-download mr-2 text-danger"></i></a>&nbsp;  
</th>
<td>{{ radio_file.download_count }} </td>

Upvotes: 0

Views: 111

Answers (1)

Ranu Vijay
Ranu Vijay

Reputation: 1257

I have option to download it by clicking on download symbol

So everytime the download is successful write a post request to map item and downloadCount (a field) and increment the downloadCount everytime a download is successful.

Upvotes: 0

Related Questions