viur-framework/viur-core

Extend `MultipleConstraints` to accept for a sort method

phorward opened this issue · 1 comments

It sometimes might be useful to automatically sort multiple bones alphabetically, or by some kind of algorithm.

Therefore, this could be possible to define:

sorted_names = StringBone(
    descr="Names",
    multiple=MultipleConstraints(sorted=True),
)

but also

sorted_names = StringBone(
    descr="Names",
    multiple=MultipleConstraints(sorted=lambda k: k[-1]),
)

Added by #1186