From b81c63898f0d52c39b5a5052d47076594899be5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Sun, 4 May 2025 22:05:47 +0200 Subject: [PATCH] Add more information in consist_item rows --- ram/consist/admin.py | 2 ++ ram/consist/models.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ram/consist/admin.py b/ram/consist/admin.py index 33df151..472b6a0 100644 --- a/ram/consist/admin.py +++ b/ram/consist/admin.py @@ -30,6 +30,8 @@ class ConsistItemInline(SortableInlineAdminMixin, admin.TabularInline): "preview", "published", "scale", + "manufacturer", + "item_number", "company", "type", "era", diff --git a/ram/consist/models.py b/ram/consist/models.py index 7dfd464..8077c3d 100644 --- a/ram/consist/models.py +++ b/ram/consist/models.py @@ -2,6 +2,7 @@ import os from django.db import models from django.urls import reverse +from django.utils.text import Truncator from django.dispatch import receiver from django.core.exceptions import ValidationError @@ -107,13 +108,21 @@ class ConsistItem(models.Model): def preview(self): return self.rolling_stock.image.first().image_thumbnail(100) + @property + def manufacturer(self): + return Truncator(self.rolling_stock.manufacturer).chars(10) + + @property + def item_number(self): + return self.rolling_stock.item_number + @property def scale(self): return self.rolling_stock.scale @property def type(self): - return self.rolling_stock.rolling_class.type + return self.rolling_stock.rolling_class.type.type @property def address(self):