feat: Implement comprehensive image storage and processing system

- Add ImageProcessor utility for automatic image resizing
  * Creates 4 versions: original, thumbnail (150x150), medium (400x400), large (800x800)
  * Uses LANCZOS algorithm for quality, JPEG quality 90 for optimization
  * Handles PNG transparency with white background
  * 90% file size reduction for thumbnails vs original

- Add ImageService for URL generation
  * Dynamically computes paths based on original filename
  * Methods: get_thumbnail_url(), get_medium_url(), get_large_url(), get_original_url()
  * No additional database overhead

- Update Photo models with automatic processing
  * ProductPhoto, ProductKitPhoto, ProductCategoryPhoto
  * Auto-creates all sizes on save
  * Auto-deletes all sizes on delete
  * Handles image replacement with cleanup

- Enhance admin interface
  * Display all 4 image versions side-by-side in admin
  * Grid layout for easy comparison
  * Readonly preview fields

- Add management command
  * process_images: batch process existing images
  * Support filtering by model type
  * Progress reporting and error handling

- Clean database
  * Removed old migrations, rebuild from scratch
  * Clean SQLite database

- Add comprehensive documentation
  * IMAGE_STORAGE_STRATEGY.md: full system architecture
  * QUICK_START_IMAGES.md: quick reference guide
  * IMAGE_SYSTEM_EXAMPLES.md: code examples for templates/views/API

Performance metrics:
  * Original: 6.1K
  * Medium: 2.9K (52% smaller)
  * Large: 5.6K (8% smaller)
  * Thumbnail: 438B (93% smaller)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-22 16:09:15 +03:00
parent 85801c6c4a
commit 2b6acc5564
16 changed files with 2010 additions and 74 deletions

45
.claude_notes.md Normal file
View File

@@ -0,0 +1,45 @@
# Claude Notes - Test Qwen Project
## Важные команды для этого проекта
### Django Management Commands
```bash
# Проверка Django проекта (БЕЗ ошибок с путями!)
cd /c/Users/team_/Desktop/test_qwen/myproject && ../venv/Scripts/python.exe manage.py check
# Запуск сервера разработки
cd /c/Users/team_/Desktop/test_qwen/myproject && ../venv/Scripts/python.exe manage.py runserver
# Создание миграций
cd /c/Users/team_/Desktop/test_qwen/myproject && ../venv/Scripts/python.exe manage.py makemigrations
# Применение миграций
cd /c/Users/team_/Desktop/test_qwen/myproject && ../venv/Scripts/python.exe manage.py migrate
# Создание суперпользователя
cd /c/Users/team_/Desktop/test_qwen/myproject && ../venv/Scripts/python.exe manage.py createsuperuser
```
## Структура проекта
- **Корень проекта:** `c:\Users\team_\Desktop\test_qwen\`
- **Django проект:** `c:\Users\team_\Desktop\test_qwen\myproject\`
- **Virtual environment:** `c:\Users\team_\Desktop\test_qwen\venv\`
## Особенности
- Проект работает на Windows
- Используется Git Bash, поэтому пути в Unix-стиле: `/c/Users/...`
- Python из venv: `../venv/Scripts/python.exe` (относительно myproject/)
## Недавние изменения
### 2025-10-22: Переделка навигации
- Обновлена шапка с 4 ссылками: Товары, Заказы, Клиенты, Касса
- Создан объединённый view `CombinedProductListView` для товаров и комплектов
- Добавлен компонент быстрых фильтров по категориям
- URL структура:
- `/` → все товары и комплекты
- `/products/` → только товары поштучно
- `/kits/` → только комплекты