Version: drop file field, use files instead #193
@ -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
|
# if it isn't cached, then the save call is applied to a different, newly fetched File instance
|
||||||
@cached_property
|
@cached_property
|
||||||
def file(self):
|
def file(self):
|
||||||
return self.files.first()
|
files = list(self.files.all())
|
||||||
|
if files:
|
||||||
|
return files[0]
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_listed(self):
|
def is_listed(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user