CachedFileInput: Fix links to download file

This commit is contained in:
Raphael Michel
2021-03-04 14:53:29 +01:00
parent 00a77d3de9
commit 97f3b72254

View File

@@ -7,6 +7,7 @@ from django.core.exceptions import ValidationError
from django.core.files import File
from django.core.files.uploadedfile import UploadedFile
from django.forms.utils import from_current_timezone
from django.urls import reverse
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
@@ -122,7 +123,7 @@ class CachedFileInput(forms.ClearableFileInput):
@property
def url(self):
return self.file.file.url
return reverse('cachedfile.download', kwargs={'id': self.file.id})
def value_from_datadict(self, data, files, name):
from ...base.models import CachedFile