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 ba8998f9e3 - Show all commits

View File

@ -78,7 +78,7 @@ class UpdateExtensionView(
def get(self, request, *args, **kwargs):
extension = self.extension
if extension.status == extension.STATUSES.DRAFT:
return redirect('extensions:draft', slug=extension.slug, type_slug=extension.type_slug)
return redirect(extension.get_draft_url())
else:
return super().get(request, *args, **kwargs)
@ -245,13 +245,6 @@ class NewVersionFinalizeView(LoginRequiredMixin, OwnsFileMixin, CreateView):
form_kwargs['instance'] = self.file.version.first()
return form_kwargs
def get_initial(self):
"""Return initial values for the version, based on the file."""
initial = super().get_initial()
initial['file'] = self.file
initial.update(**self.file.parsed_version_fields)
return initial
def get_success_url(self):
return self.object.extension.get_manage_versions_url()
@ -302,16 +295,6 @@ class DraftExtensionView(
form_kwargs['instance'] = self.extension.versions.first()
return form_kwargs
def get_initial(self):
"""Return initial values for the version, based on the file."""
initial = super().get_initial()
if self.version:
# FIXME? double-check that looking at the first file makes sense
file = self.version.files.all()[0]
initial['file'] = file
initial.update(**file.parsed_version_fields)
return initial
def get_context_data(self, form=None, extension_form=None, **kwargs):
"""Add all the additional forms to the context."""
context = super().get_context_data(**kwargs)