feat: replace color field with colors ManyToManyField in items model
All checks were successful
Build and Push Docker Image / build (push) Successful in 26s

- Updated `Item` model to use a ManyToManyField for colors, replacing the old ForeignKey relationship
- Modified templates to handle multiple color swatches in product details
- Updated admin for managing colors with `filter_horizontal`
- Adjusted views to prefetch related `colors` data for items
- Added migration to apply database changes
This commit is contained in:
2026-05-26 00:20:29 +02:00
parent c42d32c76b
commit af129309ab
5 changed files with 48 additions and 15 deletions

View File

@@ -0,0 +1,22 @@
# Generated by Django 6.0.5 on 2026-05-25 22:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('items', '0004_color_item_discount_price_item_is_new_item_color'),
]
operations = [
migrations.RemoveField(
model_name='item',
name='color',
),
migrations.AddField(
model_name='item',
name='colors',
field=models.ManyToManyField(blank=True, related_name='items', to='items.color', verbose_name='Цвета'),
),
]