Удалены все ссылки на несуществующее поле 'notes' в KitItem
Проблема: - Поле '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 <noreply@anthropic.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -127,7 +127,6 @@
|
||||
<th>Компонент</th>
|
||||
<th>Тип</th>
|
||||
<th>Количество</th>
|
||||
<th>Примечание</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -155,13 +154,6 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ item.quantity|smart_quantity }}</td>
|
||||
<td>
|
||||
{% if item.notes %}
|
||||
{{ item.notes }}
|
||||
{% else %}
|
||||
<span class="text-muted">—</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user