Remove bulk_create from admin

This commit is contained in:
Nyymix 2025-03-31 22:44:31 +03:00
parent 26a12450f4
commit 885b3530c4

View file

@ -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})