From a2c857a3cddce8eab10fead94b0d5454ded9b623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Fri, 25 Apr 2025 23:14:10 +0200 Subject: [PATCH] Fix a couple of bugs --- ram/bookshelf/models.py | 4 ++++ ram/ram/__init__.py | 2 +- ram/roster/admin.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ram/bookshelf/models.py b/ram/bookshelf/models.py index fba7aa5..3469a31 100644 --- a/ram/bookshelf/models.py +++ b/ram/bookshelf/models.py @@ -137,6 +137,10 @@ class Catalog(BaseBook): ordering = ["manufacturer", "publication_year"] def __str__(self): + # if the object is new, return an empty string to avoid + # calling self.scales.all() which would raise a infinite recursion + if self.pk is None: + return str() # empty string scales = self.get_scales() return "%s %s %s" % (self.manufacturer.name, self.years, scales) diff --git a/ram/ram/__init__.py b/ram/ram/__init__.py index abac0a2..c84cd75 100644 --- a/ram/ram/__init__.py +++ b/ram/ram/__init__.py @@ -1,4 +1,4 @@ from ram.utils import git_suffix -__version__ = "0.17.2" +__version__ = "0.17.3" __version__ += git_suffix(__file__) diff --git a/ram/roster/admin.py b/ram/roster/admin.py index f1962aa..7c79b75 100644 --- a/ram/roster/admin.py +++ b/ram/roster/admin.py @@ -273,11 +273,11 @@ class RollingStockAdmin(SortableAdminBase, admin.ModelAdmin): settings.CSV_SEPARATOR_ALT.join( t.name for t in obj.tags.all() ), - obj.decoder_interface, + obj.get_decoder_interface_display(), obj.decoder, obj.address, - obj.purchase_date, obj.shop, + obj.purchase_date, obj.price, properties, ]