From 848b6b1574c6081c657a1e6d8b722b88b12f632d Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Sat, 8 Nov 2025 16:50:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=B2=D1=81=D0=B5=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BD=D0=B5=D1=81=D1=83=D1=89=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D1=83=D1=8E=D1=89=D0=B5=D0=B5=20=D0=BF=D0=BE=D0=BB=D0=B5?= =?UTF-8?q?=20'notes'=20=D0=B2=20KitItem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Проблема: - Поле 'notes' было удалено из модели KitItem миграцией 0005 - Админка и другие части кода продолжали ссылаться на это поле - Это вызывало FieldError при попытке редактирования ProductKit в админке Решение: Удалены все 6 упоминаний поля 'notes' из кода: 1. admin.py (2 места): - KitItemInline: удалено 'notes' из fields - KitItemAdmin: удалено 'notes' из fields 2. productkit_detail.html (2 места): - Удален заголовок колонки "Примечание" - Удален блок отображения item.notes 3. demo_variants.py (2 места): - Удалено 'notes' из defaults для премиум букета - Удалено 'notes' из defaults для эконом букета Результат: - Админка ProductKit теперь работает корректно - Шаблоны не обращаются к несуществующим полям - Демо-команды создания вариантов работают без ошибок 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- myproject/products/admin.py | 4 ++-- myproject/products/management/commands/demo_variants.py | 6 ++---- .../products/templates/products/productkit_detail.html | 8 -------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/myproject/products/admin.py b/myproject/products/admin.py index 480cb67..6025f88 100644 --- a/myproject/products/admin.py +++ b/myproject/products/admin.py @@ -655,7 +655,7 @@ class KitItemPriorityInline(nested_admin.NestedTabularInline): class KitItemInline(nested_admin.NestedStackedInline): model = KitItem extra = 0 # Не показывать пустые формы - fields = ['product', 'variant_group', 'quantity', 'notes'] + fields = ['product', 'variant_group', 'quantity'] autocomplete_fields = ['product'] inlines = [KitItemPriorityInline] @@ -770,7 +770,7 @@ class KitItemAdmin(admin.ModelAdmin): list_filter = ['kit'] list_select_related = ['kit', 'product', 'variant_group'] inlines = [KitItemPriorityInline] - fields = ['kit', 'product', 'variant_group', 'quantity', 'notes'] + fields = ['kit', 'product', 'variant_group', 'quantity'] def get_type(self, obj): if obj.variant_group: diff --git a/myproject/products/management/commands/demo_variants.py b/myproject/products/management/commands/demo_variants.py index 5b13e37..2b844b4 100644 --- a/myproject/products/management/commands/demo_variants.py +++ b/myproject/products/management/commands/demo_variants.py @@ -120,8 +120,7 @@ class Command(BaseCommand): kit=kit, variant_group=group, defaults={ - 'quantity': Decimal('15.000'), - 'notes': 'Использовать самые длинные розы' + 'quantity': Decimal('15.000') } ) @@ -169,8 +168,7 @@ class Command(BaseCommand): kit=kit, variant_group=group, defaults={ - 'quantity': Decimal('15.000'), - 'notes': 'Эконом вариант' + 'quantity': Decimal('15.000') } ) diff --git a/myproject/products/templates/products/productkit_detail.html b/myproject/products/templates/products/productkit_detail.html index 7e92c82..1fa135b 100644 --- a/myproject/products/templates/products/productkit_detail.html +++ b/myproject/products/templates/products/productkit_detail.html @@ -127,7 +127,6 @@ Компонент Тип Количество - Примечание @@ -155,13 +154,6 @@ {% endif %} {{ item.quantity|smart_quantity }} - - {% if item.notes %} - {{ item.notes }} - {% else %} - - {% endif %} - {% endfor %}