support deleting extensions #69
@ -2,6 +2,7 @@ import logging
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.db.models import Q
|
||||
from django.http import Http404
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
@ -53,6 +54,8 @@ class HomeView(ListedExtensionsView):
|
||||
def extension_version_download(request, type_slug, slug, version):
|
||||
"""Download an extension version and count downloads."""
|
||||
extension_version = get_object_or_404(Version, extension__slug=slug, version=version)
|
||||
if extension_version.date_deleted is not None:
|
||||
raise Http404("This extension version has been deleted")
|
||||
ExtensionDownload.create_from_request(request, object_id=extension_version.extension_id)
|
||||
VersionDownload.create_from_request(request, object_id=extension_version.pk)
|
||||
return redirect(extension_version.downloadable_signed_url)
|
||||
|
Loading…
Reference in New Issue
Block a user