Make it possible to fully delete unlisted/unrated extensions #81

Merged
Anna Sirota merged 24 commits from fully-delete-extension into main 2024-04-19 11:00:19 +02:00
2 changed files with 3 additions and 6 deletions
Showing only changes of commit f3205d4429 - Show all commits

View File

@ -361,6 +361,7 @@ class DraftExtensionView(
def get_initial(self): def get_initial(self):
"""Return initial values for the version, based on the file.""" """Return initial values for the version, based on the file."""
initial = super().get_initial() initial = super().get_initial()
if self.version:
initial['file'] = self.version.file initial['file'] = self.version.file
initial.update(**self.version.file.parsed_version_fields) initial.update(**self.version.file.parsed_version_fields)
return initial return initial

View File

@ -1,6 +1,5 @@
from django.contrib.auth.mixins import UserPassesTestMixin from django.contrib.auth.mixins import UserPassesTestMixin
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
from django.core.exceptions import BadRequest
from extensions.models import Extension from extensions.models import Extension
from files.models import File from files.models import File
@ -60,9 +59,6 @@ class DraftVersionMixin:
def dispatch(self, *args, **kwargs): def dispatch(self, *args, **kwargs):
self.version = self.extension.versions.first() 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) return super().dispatch(*args, **kwargs)