diff --git a/hypha/apply/funds/models/mixins.py b/hypha/apply/funds/models/mixins.py index 246704a75f793869d52ab143cd79d5ee3a57f259..31612c8efffc5c506b300c112325143ff41e02b4 100644 --- a/hypha/apply/funds/models/mixins.py +++ b/hypha/apply/funds/models/mixins.py @@ -1,5 +1,3 @@ -from datetime import datetime - from django.core.files import File from django.utils.safestring import mark_safe from django_file_form.models import PlaceholderUploadedFile @@ -58,7 +56,6 @@ class AccessFormData: if isinstance(file, cls.stream_file_class): return file if isinstance(file, File): - file.name = datetime.now().strftime("%y%m%d") + "-" + file.name return cls.stream_file_class(instance, field, file, name=file.name, storage=cls.storage_class()) if isinstance(file, PlaceholderUploadedFile): diff --git a/hypha/apply/stream_forms/files.py b/hypha/apply/stream_forms/files.py index 98786d03b726a4d4d4ec6b2e4ea31bb9530bc027..c098b4d1059e5b28c24f3ff2cb4f0f4cbaaa69b0 100644 --- a/hypha/apply/stream_forms/files.py +++ b/hypha/apply/stream_forms/files.py @@ -79,6 +79,10 @@ class StreamFieldFile(File): return self.file.size return self.storage.size(self.name) + @property + def modification_time(self): + return self.storage.get_modified_time(self.name).date() + def serialize(self): return { 'url': self.url, diff --git a/hypha/apply/stream_forms/templates/stream_forms/includes/file_field.html b/hypha/apply/stream_forms/templates/stream_forms/includes/file_field.html index be121353205a7497260b3b77c67442c95d2263d0..1ff3d110991d653e8689d05622c7a98232dfe0c7 100644 --- a/hypha/apply/stream_forms/templates/stream_forms/includes/file_field.html +++ b/hypha/apply/stream_forms/templates/stream_forms/includes/file_field.html @@ -1,6 +1,7 @@ <a class="link link--download" href="{{ file.url }}" target="_blank" rel="noopener noreferrer"> <div> <svg><use xlink:href="#file"></use></svg> + <span>{{ file.modification_time }}</span> <span>{{ file.filename }}</span> </div> <svg><use xlink:href="#download"></use></svg>