Multi-platform: support multiple files per version #201

Merged
Oleg-Komarov merged 43 commits from multi-os into main 2024-07-09 16:27:46 +02:00
Showing only changes of commit 8b376825c8 - Show all commits

View File

@ -757,14 +757,13 @@ class Version(CreatedModifiedMixin, TrackChangesMixin, models.Model):
def _get_download_name(self, platform=None) -> str:
"""Return a file name for downloads."""
replace_char = f'{self}'.replace('.', '-')
parts = [self.extension.type_slug_singular, self.extension.slug, f'v{self.version}']
if platform:
return f'{utils.slugify(replace_char)}.{platform}.zip'
else:
return f'{utils.slugify(replace_char)}.zip'
parts.append(platform)
return f'{"-".join(parts)}.zip'
def get_download_url(self, platform=None, append_repository_and_compatibility=True) -> str:
filename = f'{self.extension.type_slug_singular}-{self.extension.slug}-v{self.version}.zip'
filename = self._get_download_name(platform=platform)
if platform:
download_url = reverse(
'extensions:version-platform-download',