Remove bulk_create from admin
This commit is contained in:
parent
26a12450f4
commit
885b3530c4
1 changed files with 2 additions and 1 deletions
|
@ -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})
|
||||
|
|
Loading…
Add table
Reference in a new issue