Add bulk photo deletion feature for products.

Allows selecting and deleting multiple photos at once via checkboxes
and an AJAX endpoint. Key features:
- Checkboxes next to each photo in edit form
- Delete button that shows only when photos are selected
- AJAX request with JSON payload and success confirmation
- DOM removal and counter update after deletion
- Uses existing ImageProcessor cleanup logic

Files changed:
- product_form.html: Added checkboxes and delete button with JS handler
- photo_management.py: Added product_photos_delete_bulk AJAX view
- urls.py: Added /product/photos/delete-bulk/ endpoint
- views/__init__.py: Exported new function

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-23 21:49:50 +03:00
parent 26146ac639
commit 493b6c212d
4 changed files with 185 additions and 4 deletions

View File

@@ -24,6 +24,7 @@ urlpatterns = [
path('product/photo/<int:pk>/set-main/', views.product_photo_set_main, name='product-photo-set-main'),
path('product/photo/<int:pk>/move-up/', views.product_photo_move_up, name='product-photo-move-up'),
path('product/photo/<int:pk>/move-down/', views.product_photo_move_down, name='product-photo-move-down'),
path('product/photos/delete-bulk/', views.product_photos_delete_bulk, name='product-photos-delete-bulk'),
# CRUD URLs for ProductKit (комплекты/букеты)
path('kit/create/', views.ProductKitCreateView.as_view(), name='productkit-create'),