feat: replace color field with colors ManyToManyField in items model
All checks were successful
Build and Push Docker Image / build (push) Successful in 26s
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:
22
items/migrations/0005_remove_item_color_item_colors.py
Normal file
22
items/migrations/0005_remove_item_color_item_colors.py
Normal 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='Цвета'),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user