From 72855546ceb4fc2a7247c6c12becbafe3776dd16 Mon Sep 17 00:00:00 2001 From: Tijs-B Date: Mon, 25 Mar 2024 23:20:54 +0100 Subject: [PATCH] Convert label to str in graph_transitions.py If the label of a state is not a string, trying to add it to the graphviz Graph will fail. This could be the case when using `FSMFieldMixin` instead of directly using `FSMField`. --- django_fsm/management/commands/graph_transitions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_fsm/management/commands/graph_transitions.py b/django_fsm/management/commands/graph_transitions.py index e21c98a..9ce6da7 100644 --- a/django_fsm/management/commands/graph_transitions.py +++ b/django_fsm/management/commands/graph_transitions.py @@ -105,9 +105,9 @@ def generate_dot(fields_data): final_states = targets - sources for name, label in final_states: - subgraph.node(name, label=label, shape="doublecircle") + subgraph.node(name, label=str(label), shape="doublecircle") for name, label in (sources | targets) - final_states: - subgraph.node(name, label=label, shape="circle") + subgraph.node(name, label=str(label), shape="circle") if field.default: # Adding initial state notation if label == field.default: initial_name = node_name(field, "_initial")