Multi-platform: support multiple files per version #201
@ -78,7 +78,7 @@ class UpdateExtensionView(
|
|||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
extension = self.extension
|
extension = self.extension
|
||||||
if extension.status == extension.STATUSES.DRAFT:
|
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:
|
else:
|
||||||
return super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
|
|
||||||
@ -245,13 +245,6 @@ class NewVersionFinalizeView(LoginRequiredMixin, OwnsFileMixin, CreateView):
|
|||||||
form_kwargs['instance'] = self.file.version.first()
|
form_kwargs['instance'] = self.file.version.first()
|
||||||
return form_kwargs
|
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):
|
def get_success_url(self):
|
||||||
return self.object.extension.get_manage_versions_url()
|
return self.object.extension.get_manage_versions_url()
|
||||||
|
|
||||||
@ -302,16 +295,6 @@ class DraftExtensionView(
|
|||||||
form_kwargs['instance'] = self.extension.versions.first()
|
form_kwargs['instance'] = self.extension.versions.first()
|
||||||
return form_kwargs
|
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):
|
def get_context_data(self, form=None, extension_form=None, **kwargs):
|
||||||
"""Add all the additional forms to the context."""
|
"""Add all the additional forms to the context."""
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user