|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import django |
|
|
|
|
from django.http import JsonResponse |
|
|
|
|
from django.core.exceptions import PermissionDenied |
|
|
|
|
|
|
|
|
@ -23,6 +24,11 @@ class DropUploadAdminMixin:
|
|
|
|
|
def upload(self, request): |
|
|
|
|
# We must initialize a fake-ChangeList to be able to get the currently |
|
|
|
|
# selected categories. |
|
|
|
|
|
|
|
|
|
if django.VERSION >= (2, 0, 0): |
|
|
|
|
changelist = self.get_changelist_instance(request) |
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
# Code copied from django.contrib.admin.options.ModelAdmin.changelist_view |
|
|
|
|
if not self.has_change_permission(request, None): |
|
|
|
|
raise PermissionDenied |
|
|
|
|