Skip to content

Commit

Permalink
Set default value on clone for Sortindex bones
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneGudermann committed Jan 31, 2025
1 parent 9caad83 commit 0e9f0e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/viur/core/prototypes/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from viur.core.decorators import *
from viur.core.cache import flushCache
from viur.core.skeleton import SkeletonInstance
from viur.core.bones import BaseBone
from viur.core.bones import SortIndexBone
from .skelmodule import SkelModule


Expand Down Expand Up @@ -386,6 +386,10 @@ def clone(self, key: db.Key | str | int, **kwargs):
or not skel.fromClient(kwargs) # failure on reading into the bones
or utils.parse.bool(kwargs.get("bounce")) # review before changing
):
for bone_name, bone in skel.items():
if not isinstance(bone, SortIndexBone):
continue
skel[bone_name] = bone.getDefaultValue(skel)
return self.render.edit(skel, action="clone")

self.onClone(skel, src_skel=src_skel)
Expand Down

0 comments on commit 0e9f0e4

Please sign in to comment.