Feature: Добавлены методы получения суммы заказов клиента
Добавлены методы в модель Customer для расчета суммы успешных заказов: - get_successful_orders_total() - гибкий метод с фильтрацией по датам - get_last_year_orders_total() - сумма за последний год Удалено устаревшее поле total_spent: - Методы предоставляют более точные и актуальные данные - Используют агрегацию на уровне БД для производительности Обновлен UI карточки клиента: - Отображается сумма всех успешных заказов - Отображается сумма заказов за последний год - Убрана колонка total_spent из списка клиентов Изменения: - customers/models.py: добавлены методы, удалено поле total_spent - customers/views.py: добавлен расчет сумм в контекст - customers/templates: обновлены шаблоны - customers/admin.py: удалены упоминания total_spent - Создана миграция 0005_remove_total_spent 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
17
myproject/customers/migrations/0005_remove_total_spent.py
Normal file
17
myproject/customers/migrations/0005_remove_total_spent.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.0.10 on 2025-12-05 21:17
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('customers', '0004_customer_wallet_balance_wallettransaction'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='customer',
|
||||
name='total_spent',
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user