From bb58dcf6fa9632c6c23bd7644de1577a6a1358bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Mon, 27 Jan 2025 23:52:37 +0100 Subject: [PATCH] Fix a bug related to consist --- ram/consist/models.py | 9 +++++---- ram/ram/__init__.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ram/consist/models.py b/ram/consist/models.py index a6ce884..f89b5b9 100644 --- a/ram/consist/models.py +++ b/ram/consist/models.py @@ -105,7 +105,8 @@ class ConsistItem(models.Model): # it is hosted here to avoid circular imports @receiver(models.signals.post_save, sender=RollingStock) def post_save_unpublish_consist(sender, instance, *args, **kwargs): - consists = Consist.objects.filter(consist_item__rolling_stock=instance) - for consist in consists: - consist.published = False - consist.save() + if not instance.published: + consists = Consist.objects.filter(consist_item__rolling_stock=instance) + for consist in consists: + consist.published = False + consist.save() diff --git a/ram/ram/__init__.py b/ram/ram/__init__.py index 10b4281..529927a 100644 --- a/ram/ram/__init__.py +++ b/ram/ram/__init__.py @@ -1,4 +1,4 @@ from ram.utils import git_suffix -__version__ = "0.16.5" +__version__ = "0.16.6" __version__ += git_suffix(__file__)