Added an accessed_date field on TrackFile for easier cache deletion (#189)
This commit is contained in:
parent
2649ad88ff
commit
f343159856
4 changed files with 38 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ from django.db.models.functions import Length
|
|||
from django.db.models import Count
|
||||
from django.http import StreamingHttpResponse
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.decorators import method_decorator
|
||||
|
||||
from rest_framework import viewsets, views, mixins
|
||||
|
|
@ -264,6 +265,10 @@ class TrackFileViewSet(viewsets.ReadOnlyModelViewSet):
|
|||
except models.TrackFile.DoesNotExist:
|
||||
return Response(status=404)
|
||||
|
||||
# we update the accessed_date
|
||||
f.accessed_date = timezone.now()
|
||||
f.save(update_fields=['accessed_date'])
|
||||
|
||||
mt = f.mimetype
|
||||
audio_file = f.audio_file
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue