Closed devidw closed 9 months ago
When the whole download process is handled by django you can use the request-finished
.
However if the download is handled by the reverse proxy (Apache or Nginx or other) there is no way to handle it in django since the process is not handled by the application server.
I see, thanks @sevdog
When applications want to indicate to users whether they have seen/downloaded a document or not, this would probably happen with the help of a boolean
has_been_downloaded
model field on the corresponding model.To actually turn this field true once a document has been downloaded, it would be really helpful if the package could send a signal, offer a hook, that gets triggered, when a document was shipped successfully.
I guess this could be implemented with some custom code in a custom view that wraps one of the package views.
DRF example:
But this would always happen before the actual download code runs and therefore, when the download somehow fails, data would wrongly be changed in the model.