Multi-platform: support multiple files per version #201
@ -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}']
|
||||
Oleg-Komarov marked this conversation as resolved
Outdated
|
||||
if platform:
|
||||
return f'{utils.slugify(replace_char)}.{platform}.zip'
|
||||
else:
|
||||
return f'{utils.slugify(replace_char)}.zip'
|
||||
parts.append(platform)
|
||||
Oleg-Komarov marked this conversation as resolved
Outdated
Anna Sirota
commented
to avoid making platform into file ext, maybe to avoid making platform into file ext, maybe `-`?
|
||||
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',
|
||||
|
Loading…
Reference in New Issue
Block a user
The
filename
belowfilename = f'{self.extension.type_slug_singular}-{self.extension.slug}-v{self.version}.zip'
looks like a better name: doesn't rely on
self.__str__
.It also looks like these file names should be the same in both places.