Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Convert label to str in graph_transitions.py
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
Tijs-B authored and kmmbvnr committed Mar 26, 2024
1 parent 77a4d77 commit 7285554
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django_fsm/management/commands/graph_transitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 7285554

Please sign in to comment.