Удалена система лояльности из модели Customer

Удалены поля loyalty_tier, is_vip, get_loyalty_discount(), increment_total_spent().
Поле total_spent оставлено для будущего расчёта по заказам.
Обновлены admin, forms, views и шаблоны.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-22 17:05:18 +03:00
parent 59a7152967
commit fac3d55083
6 changed files with 8 additions and 121 deletions

View File

@@ -38,34 +38,10 @@
<th>Телефон:</th>
<td>{{ customer.phone|default:"Не указано" }}</td>
</tr>
<tr>
<th>Уровень лояльности:</th>
<td>
<span>({{ customer.get_loyalty_discount }}% скидка)</span>
<span class="badge ms-2
{% if customer.loyalty_tier == 'bronze' %}bg-secondary text-dark
{% elif customer.loyalty_tier == 'silver' %}bg-light text-dark
{% elif customer.loyalty_tier == 'gold' %}bg-warning text-dark
{% elif customer.loyalty_tier == 'platinum' %}bg-primary text-white
{% endif %}">
{{ customer.get_loyalty_tier_display }}
</span>
</td>
</tr>
<tr>
<th>Сумма покупок:</th>
<td>{{ customer.total_spent|floatformat:2 }} руб.</td>
</tr>
<tr>
<th>VIP:</th>
<td>
{% if customer.is_vip %}
<span class="badge bg-success">Да</span>
{% else %}
<span class="badge bg-secondary">Нет</span>
{% endif %}
</td>
</tr>
<tr>
<th>Заметки:</th>
<td>{{ customer.notes|default:"Нет" }}</td>

View File

@@ -81,16 +81,13 @@
<th>Имя</th>
<th>Email</th>
<th>Телефон</th>
<th>Уровень лояльности</th>
<th>Сумма покупок</th>
<th>VIP</th>
<th class="text-end">Действия</th>
</tr>
</thead>
<tbody>
{% for customer in page_obj %}
<tr
class="{% if customer.is_vip %}table-warning{% endif %}"
<tr
style="cursor:pointer"
onclick="window.location='{% url 'customers:customer-detail' customer.pk %}'"
>
@@ -98,33 +95,12 @@
<td>{{ customer.email|default:'—' }}</td>
<td>{{ customer.phone|default:'—' }}</td>
<td>
<span class="badge
{% if customer.loyalty_tier == 'no_discount' %}bg-light text-muted
{% elif customer.loyalty_tier == 'bronze' %}bg-secondary text-white
{% elif customer.loyalty_tier == 'silver' %}bg-info text-dark
{% elif customer.loyalty_tier == 'gold' %}bg-warning text-dark
{% elif customer.loyalty_tier == 'platinum' %}bg-primary text-white
{% endif %}
">
{{ customer.get_loyalty_tier_display }}
</span>
</td>
<td>{{ customer.total_spent|default:0|floatformat:2 }} руб.</td>
<td>
{% if customer.is_vip %}
<span class="badge bg-success">Да</span>
{% else %}
<span class="badge bg-secondary text-white">Нет</span>
{% endif %}
</td>
<td class="text-end" onclick="event.stopPropagation();">
<a href="{% url 'customers:customer-detail' customer.pk %}"
<a href="{% url 'customers:customer-detail' customer.pk %}"
class="btn btn-sm btn-outline-primary">👁</a>
<a href="{% url 'customers:customer-update' customer.pk %}"
<a href="{% url 'customers:customer-update' customer.pk %}"
class="btn btn-sm btn-outline-secondary"></a>
</td>
</tr>