Add OrderStatus to Django admin with Russian translations

- Add OrderStatusAdmin to admin panel with custom display methods
- Implement color preview, order badge, and order count displays
- Protect system statuses from deletion and code modification
- Add orders_count property to OrderStatus model
- Create migration to translate status names to Russian
- Use format_html for safe HTML rendering in admin

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-13 18:07:34 +03:00
parent d472056c64
commit d7cfb07695
3 changed files with 168 additions and 1 deletions

View File

@@ -99,6 +99,11 @@ class OrderStatus(models.Model):
def __str__(self):
return self.name
@property
def orders_count(self):
"""Количество заказов в этом статусе"""
return self.orders.count()
class Address(models.Model):
"""