Use a materialized Extension.latest_version field instead of a dynamic property #152

Merged
Oleg-Komarov merged 15 commits from latest-version-field into main 2024-05-27 17:58:56 +02:00
Showing only changes of commit bbb7c9fc85 - Show all commits

View File

@ -409,7 +409,7 @@ class Extension(CreatedModifiedMixin, RatingMixin, TrackChangesMixin, models.Mod
@transaction.atomic
def update_latest_version(self, skip_version=None):
versions = self.versions.select_related('file').all().order_by('-date_created')
versions = self.versions.select_related('file').order_by('-date_created')
Oleg-Komarov marked this conversation as resolved Outdated

select_related missing for .file

`select_related` missing for `.file`
latest_version = None
for version in versions:
if skip_version and version == skip_version: