From 885b3530c49a691977bd8c672d40c3f66080c445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9DNyymix=E2=80=9D?= Date: Mon, 31 Mar 2025 22:44:31 +0300 Subject: [PATCH] Remove bulk_create from admin --- gallery/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gallery/admin.py b/gallery/admin.py index 3b25afd..5e9ca83 100644 --- a/gallery/admin.py +++ b/gallery/admin.py @@ -95,7 +95,8 @@ class AlbumAdmin(admin.ModelAdmin): if not uploaded_files: return JsonResponse({"error": "No files uploaded."}, status=400) - Photo.objects.bulk_create([Photo(album=album, photo=file) for file in uploaded_files]) + for file in uploaded_files: + Photo.objects.create(album=album, photo=file) return JsonResponse({"message": "Photos uploaded successfully!"}) return render(request, 'admin/upload_photos.html', {'album': album})