All checks were successful
Build and Push Docker Image / build (push) Successful in 45s
- Added `ItemImage` model with migration for image handling and metadata - Implemented product gallery in `detail.html` with thumbnails for additional images - Updated `Item` model to include `primary_image` property for gallery logic - Enhanced `catalog/index.html` to support item thumbnails - Updated `catalog.css` for responsive gallery and item list styling - Extended catalog views to prefetch images for efficient queries - Added comprehensive tests for catalog and detail views - Configured Django to serve media files in development - Updated admin with inline support for managing `ItemImage` entities
31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
# Generated by Django 6.0.4 on 2026-04-26 14:27
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('items', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='ItemImage',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('image', models.ImageField(upload_to='items/', verbose_name='Изображение')),
|
|
('alt', models.CharField(blank=True, max_length=255, verbose_name='Alt-текст')),
|
|
('sort_order', models.PositiveIntegerField(default=0, verbose_name='Порядок')),
|
|
('is_primary', models.BooleanField(default=False, verbose_name='Главное изображение')),
|
|
('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='items.item', verbose_name='Товар')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Изображение товара',
|
|
'verbose_name_plural': 'Изображения товара',
|
|
'ordering': ('-is_primary', 'sort_order', 'id'),
|
|
},
|
|
),
|
|
]
|