Make it possible to fully delete unlisted/unrated extensions #81
@ -361,8 +361,9 @@ class DraftExtensionView(
|
||||
def get_initial(self):
|
||||
"""Return initial values for the version, based on the file."""
|
||||
initial = super().get_initial()
|
||||
initial['file'] = self.version.file
|
||||
initial.update(**self.version.file.parsed_version_fields)
|
||||
if self.version:
|
||||
initial['file'] = self.version.file
|
||||
initial.update(**self.version.file.parsed_version_fields)
|
||||
return initial
|
||||
|
||||
def get_context_data(self, form=None, extension_form=None, add_preview_formset=None, **kwargs):
|
||||
|
@ -1,6 +1,5 @@
|
||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.core.exceptions import BadRequest
|
||||
|
||||
from extensions.models import Extension
|
||||
from files.models import File
|
||||
@ -60,9 +59,6 @@ class DraftVersionMixin:
|
||||
|
||||
def dispatch(self, *args, **kwargs):
|
||||
self.version = self.extension.versions.first()
|
||||
if self.version is None:
|
||||
error_message = f'Extension "{self.extension.name}" has no versions.'
|
||||
raise BadRequest(error_message)
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user