Version: drop file field, use files instead #193

Merged
Oleg-Komarov merged 6 commits from version-drop-file into main 2024-06-21 11:29:22 +02:00
Showing only changes of commit 83c51dc51b - Show all commits

View File

@ -675,7 +675,11 @@ class Version(CreatedModifiedMixin, TrackChangesMixin, models.Model):
# if it isn't cached, then the save call is applied to a different, newly fetched File instance
@cached_property
def file(self):
return self.files.first()
files = list(self.files.all())
if files:
return files[0]
else:
return None
@property
def is_listed(self):