Skip to content

Commit 573902b

Browse files
committed
fix: Add save_m2m() call to SegmentForm to properly save tags
The SegmentForm was not saving many-to-many relationships like tags because the overridden save() method was missing the save_m2m() call. This caused tags to be lost when saving segment instances, while service path forms worked correctly. Added self.save_m2m() call after instance.save() when commit=True to ensure all many-to-many fields (including tags) are properly persisted to the database. Fixes: Tags not being saved in segment forms
1 parent 47dced9 commit 573902b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cesnet_service_path_plugin/forms/segment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def save(self, commit=True):
157157

158158
if commit:
159159
instance.save()
160+
self.save_m2m() # This is required to save many-to-many fields like tags
160161

161162
return instance
162163

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "cesnet_service_path_plugin"
7-
version = "5.0.2"
7+
version = "5.0.3"
88
description = "Adds ability to create, edit and view service paths in the CESNET network."
99
authors = [
1010
{name = "Jan Krupa", email = "[email protected]"},
@@ -46,4 +46,4 @@ include = ["cesnet_service_path_plugin*"]
4646

4747
[tool.setuptools.package-data]
4848
# This replaces include_package_data=True
49-
"*" = ["*"]
49+
"*" = ["*"]

0 commit comments

Comments
 (0)